Boolean Search vs. Stopwords

The SearchStax Site Search solution honors both the Solr stopwords feature and its Boolean query feature. This can sometimes be confusing, so we've prepared some examples here.

  • The examples are from a Crawler demo based on the SearchStax documentation corpus. Stopwords are enabled for this demo.
  • Lowercase and mixed-case and, or, not are interpreted as query keywords. These are treated as stopwords when appropriate.
  • Uppercase AND, OR, NOT are interpreted as Boolean operators.
  • Depending on usage, the hyphen (-) may be ignored or treated as a shorthand for NOT.
  • The plus (+) requires that the following term be present.

Example Queries

In the table below, the Input Query is the user input. The Parsed Query represents how Solr interpreted it.

Input Query Parsed Query Hits Notes
stop stop 17 Documents contain “stop”
words word 16 Docs contain “word” (using stemming)
stop words stop word 30 Docs contain either “stop” or “word.” Three contain both.
stop and words stop and word 30 Stopword “and” removed.
stop And words stop And word 30 mixed case “And” is treated as stop word.
stop AND words stop AND word 3 Boolean AND (all capitals). Doc must have both terms.
stop or words stop or word 30 Stopword “or” removed.
stop OR words stop OR word 30 Boolean OR. Same as default search.
stop not words stop not word 30 Stopword “not” removed.
stop NOT words stop NOT word 14 Boolean NOT. "Stop" is present but "word" isn't.
stop-words stop word 30 Solr removes the hyphen.
stop -words stop NOT word 14 Hyphen prefix is shorthand for NOT.
“stop-words” “stop word” 3 Phrase query. “Stop” and “word” must be adjacent and in this order.
+stop words +stop word 17 Must include “stop.” Will score higher if “word” is present, too.
Articles in this section