I have a channel that I don't want searchable, however suggestive search results containing entry titles for this channel still appear. I'm using Super Search 2.04 and EE 2.5.2. I know that you can easily disable searching on custom channel fields but I need to disable searching for the entry titles of this channel. Further I thought that changing all entries to status closed might resolve it but it does not. Any tips or suggestions would be greatly appreciated!
3 Answers
You can set specific channels to limit results on your exp:super_search:results tag like:
{exp:super_search:results
channel="news|another_channel"
limit="20"
hightlight_keywords="strong"
}
(see solspace docs here, and under "why does it work that way" heading). Setting the channel parameter here should prevent results from showing up from the channel you want hidden.
If you only have a single channel that you are trying to exclude I often find it easier to use the not parameter to your template tags. The following would not show any entries from a channel with a short name of "excluded_channel" or any entries that have a status that is set to closed.
{exp:super_search:results
channel="not excluded_channel"
status="not closed"
limit="10"
}
You can add a pipe delimiter between multiple channels or status to exclude multiple. i.e. status="not closed|preview"
or channel="not excluded_channel|home"
My apologies as it turns out this issue wasn't completely related to Super Search. There was also suggestive search results being powered by the following code:
<?php $term = $_GET['term']; ?>
{exp:ifelse parse="inward"}
{if group_id == '20' OR member_id == '79' OR member_id == '9' OR member_id == '113' OR member_id == '129'}
[{exp:query sql="SELECT title, channel_id FROM exp_channel_titles WHERE title LIKE '%<?php echo $term; ?>%' AND channel_id NOT IN (82,80,61,63,51,54,9,39,40,46,56,37,60,66,67,68,69,37,78,93) GROUP BY title ORDER BY title ASC" backspace="1"}"{title}",{if no_results}"No Results"{/if}{/exp:query}]
{if:else}
[{exp:query sql="SELECT title, channel_id, entry_id FROM exp_channel_titles WHERE title LIKE '%<?php echo $term; ?>%' AND channel_id NOT IN (82,80,61,63,51,54,9,39,40,46,56,37,60,66,67,68,69,37,78,93) AND entry_id NOT IN (2589,2590,2591,2592,3575,3577,4154) GROUP BY title ORDER BY title ASC" backspace="1"}"{title}",{if no_results}"No Results"{/if}{/exp:query}]
{/if}
{/exp:ifelse}
In order to remove the channels I wanted from these suggestive search phrases I just had to edit the MySQL query adding the channel ID's of the ones I didn't want searched into the NOT IN part of the query. Thanks to Justin and Roman for your tips and to remove channels from the search results (not the suggestive search) they worked perfectly. My apologies for not clarifying my question a little better in regards to the suggested search results.