lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Site search upsells & boosting by content type
Date Wed, 17 Feb 2010 22:06:31 GMT

: 54 results with that particular event on top.  However, if I try to 
: boost another term, such as "+(old 97's) || granada^100" - I get over 
: 300 results because it adds in all of the matches for the word 

In Solr/Lucene, the keywords of "AND" and "OR" are really just syntactic 
sugar for making two clauses mandatory or optional -- which means that 
something like this...

	+FOO || BAR

...causes a "FOO" clause to be created which is mandatory, and then a 
BAR clause is created and both the FOO and BAR clause are set to optional. 
(because of the binary OR specificed by "||")

You can see all of this if you look at the parsedquery in the 
debugQuery=true output.

The sucky part of overriding the "default operator" is that when you set 
it to "AND" there is no syntax to force a clause to be "optional" .. which 
is why i recommend *never* changing the default operrator, and using "+" 
to denote when you wnat to make things mandatory.

: "granada".  This is not what I want.  Instead of AND or OR, I want AND 

In Lucene/Solr there is (really) no "AND" or "OR" or "AND MAYBE" .. there 
are just "MANDATORY" "PROHIBITED" and "OPTIONAL" ... in the expression 
"+FOO BAR" FOO becomes MANDATORY and BAR becomes optional, which is 
equivilent to "AND MAYBE" in other parsers.

nine times out of ten, when people are asking questions like this, the 
best answer is:

  1) use the dismax parser
  2) put the input from your user in the q param
  3) set the mm param to 100%
  4) put the boost query you want to use in the bq param


View raw message