Search Operators: Phrases, Required and Excluded Words

Quotes, plus and minus, with AI on or off

Search Operators

Visitors can refine any search with the operators they know from other search boxes: "quotes" for a phrase, + for a word every result must have, - for a word no result may have. They work with AI on and with AI off.

TypeWhat it doesExample
"word1 word2"Phrase: those words together, in that order"machine learning"
+wordRequired: every result contains it+laptop 15 inch gaming
+"word1 word2"Required phrase+"13 inch"
-wordExcluded: no result contains itlaptop -refurbished
-"word1 word2"Excluded phrase-"open box"

They combine freely in one search. On the hosted search page, the ? button next to Search opens the same list for visitors.

They hold in a hybrid search too

A hybrid search matches the words and the meaning. The meaning side cannot read a minus sign: left alone, it would even move toward the word the visitor wanted out.

So Opensolr takes every + and - word out of the search and applies it as a filter on the whole result list. A result found by meaning cannot bring back an excluded word, and the excluded word never reaches the meaning side.

laptop -refurbished Words matches the word laptop Meaning cannot read a minus sign Filter: drop every result with refurbished Results without refurbished listings laptop -refurbished Words matches laptop Meaning cannot read a minus sign Filter: drop every result with refurbished No refurbished listing

Good to know

  • A phrase on its own, with no + in front, helps the order but does not filter while AI is on, so a page that says the same thing in other words can still come up. Write +"machine learning" to require the exact phrase, or turn AI off.
  • Hyphenated words are safe. + and - count only at the start of a word, so e-mail, covid-19 and 1+1 are searched as they are. A - inside quotes belongs to the phrase.

Where they work

On the hosted search page and the search you embed on your site, in the Drupal module, the WordPress plugin and the five developer packages: LangChain, LlamaIndex, Haystack, Laravel Scout and MCP.

Meaning, pictures, answers

Back to Enterprise Site Search