In the edit search page form, we have the following explanatory text:

'A comma-separated list of lucene filter queries to apply by default. E.g. "bundle:blog, is_uid:(1 OR 2 OR %). % will be replaced by the value of % in the path"'

I couldn't find any documentation anywhere about how to exclude terms, and eventually managed to deduce it from the source code. But perhaps it should explain that "-bundle:blog" with a minus sign in front of it will exclude all blog items.

Comments

Nick_vh’s picture

I'd be happy to commit a better documentation in regards to this fact. Could you make a start and/or a patch?

cpliakas’s picture

Do you think it would make sense to add a link to the Apache Lucene - Query Parser Syntax page or copy the text into a help page? In addition, it might help to point people to the Reports page so they can see what fields are available.

arebacollins’s picture

Issue summary: View changes

I still dont get how this works: How do I exclude all content of type plant_pests where field is_minor_pest is 1 (meaning I would like to include plant_pests where field is_minor_pest is 0 in the search)?

Thanks.

jgrubb’s picture

Assigned: Unassigned » jgrubb

@arebacollins something like this --

bundle:"plant_pests" AND is_minor_pest:0

ThePickwickProject’s picture

@arebacollins

I was running in a similar problem and I was able to solve it when I realized you need to use the field names as known and indexed by Lucene / Solr.

e.g. when you want to filter on the content type field is_minor_pest, you'll likely have a field "sm_is_minor_pest" and the syntax would be sm_is_minor_pest:0 You can find these field names when using facets.

If someone has more additional info, specifically about how to create an Apache Solr Search Page that restricts search to all content from a content type where a field has a specific value, I would be interested.

e.g. Content Type: News with field_news_type: Sports

the syntax to use is probably not

bundle:"News" AND field_news_type:"Sports"

but rather something like

bundle:"Newss" AND sm_field_news_type:"Sports"