I am working on an EE 1.6.8 site and need to conditionally display search results based on categories. However, I am getting duplicated content in my results.
{exp:search:search_results disable="member_data|trackbacks" orderby="date" paginate="bottom" limit="30" show_expired="no" show_future_entries="no"}
{exp:localisation:local_query local_sql_url_title="content-from-url-title" page_url_title="{url_title}" channel_ids="6,9"}
{exp:query sql="{local_sql_query}" show_future_entries="no" }
{categories}
{if category_name == "Videos"} {category_name}
content
content
{if:elseif category_name == "Images"} {category_name}
content
{if:elseif weblog_short_name == "press-releases" AND category_name != "Videos" AND category_name != "Audio" AND category_name != "Images"} {category_name}
content
{if:elseif weblog_short_name == "articles" AND category_name != "Videos" AND category_name != "Audio" AND category_name != "Images"} {category_name}
content
{if:elseif weblog_short_name == "press-kits" AND category_name != "Videos" AND category_name != "Audio" AND category_name != "Images"} {category_name}
content
{/if}
{/categories}
{/exp:query}
{/exp:localisation:local_query }
{/exp:search:search_results}The problem is that an item of content might have a category assigned called “Videos” and another category assigned called “Global” which I think might be in a different category group called “Regions”, if such a thing exists in EE. So I am getting duplicated results for some articles - one for each of the categories it is assigned to.
Does anyone have a way round this?