All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Exclude some entries from Low Search

James 28 May 2019 23:23 question, complete

So I have a search that is for our entire site. It searches across a number of different channels with different field sets.

The basic results tag looks like this:
{exp:low_search:results query="{segment_3}" limit="10" channel="blog|whitepaper|video|press|static" dynamic="no"}

There are certain entries in the various channels that need to be excluded from the search. In the various channels there's a checkbox that gets checked to indicate it should be hidden. In normal channel entries tags I'd use the "search:" parameter to make sure those entries aren't included in the output. But I'm not quite sure how to accomplish that when using Low Search with multiple channels in the results.

So as an example here's 2 of the searches I commonly use for 2 different channels so that the private entries are not displayed:
search:resource-exclude="not Yes"
search:static-index="not Yes"

How can I use these parameters within Low Search?

Replies

  1. Low 29 May 2019 06:30

    My advice would be to use a status for this, which is shared across all channels. But if that's not an option, you could try and use the smart_field_search="yes" parameter, which would only apply the field search parameters to the channels they belong to: https://gotolow.com/addons/low-search...

  2. James 30 May 2019 00:26

    So with the smart_field_search set to yes, how would I specify multiple search:field_name parameters for different channels. Would I just put it in multiple times like this:

    {exp:low_search:results
    query="{segment_3}"
    limit="10"
    channel="blog|whitepaper|video|press|static"
    dynamic="no"
    smart_field_search="yes"
    search:resource-exclude="not Yes"
    search:static-index="not Yes"}

    Or is there a different syntax? Also, do I need to specify which search:field_name is for which channel?

  3. Low 31 May 2019 08:34

    smart_field_search="yes" would do the trick. It automatically tries to determine which fields belong to which channels.

    By the way, since you're saying 'not X' in both parameters, you should even be able make it work *without* the parameter. For any other channel, the field will be empty (null or an empty string), which should return true for field != 'yes'. In that sense, you don't even need to determine which fields belong to which channel.