You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2011/02/06 01:32:05 UTC

[Solr Wiki] Trivial Update of "DisMaxQParserPlugin" by Bill Bell

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "DisMaxQParserPlugin" page has been changed by Bill Bell.
http://wiki.apache.org/solr/DisMaxQParserPlugin?action=diff&rev1=3&rev2=4

--------------------------------------------------

  <<TableOfContents>>
  
  == Overview ==
- 
  This query parser supports an extremely simplified subset of the Lucene !QueryParser syntax.  Quotes can be used to group phrases, and +/- can be used to denote mandatory and optional clauses ... but all other Lucene query parser special characters are escaped to simplify the user experience.  The handler takes responsibility for building a good query from the user's input using !BooleanQueries containing !DisjunctionMaxQueries across fields and boosts you specify.  It also lets you provide additional boosting queries, boosting functions, and filtering queries to artificially affect the outcome of all searches.  These options can all be specified as default parameters for the handler in your solrconfig.xml or overridden in the Solr query URL.
  
  == Query Syntax ==
- 
  This is designed to be support raw input strings provided by users with no special escaping.   '+' and '-' characters are treated as "mandatory" and "prohibited" modifiers for the subsequent terms.  Text wrapped in balanced quote characters '"' are treated as phrases, any query containing an odd number of quote characters is evaluated as if there were no quote characters at all.  Wildcards  are not supported.
  
  == Query Structure ==
- 
  For each "word" in the query string, dismax builds a !DisjunctionMaxQuery object for that word across all of the fields in the `qf` param (with the appropriate boost values and a tiebreaker value set from the `tie` param).  These !DisjunctionMaxQuery objects are then put in a !BooleanQuery with the minNumberShouldMatch option set according to the `mm` param.  If any other params are specified, a larger !BooleanQuery is wrapped arround the first !BooleanQuery from the `qf` options, and the other params (`bf`, `bq`, `pf`) are added as optional clauses.  The only complex clause comes from from the `pf` param, which is a single !DisjuntionMaxQuery containing the whole query 'phrase' against each of the `pf` fields.
  
  /!\ :TODO: /!\ Need more detail on the query structure generated based on input ... a picture would be nice.
  
  == Parameters ==
- 
  The following parameters are supported, either as regular request params, or as local params
  
  /!\ :TODO: /!\ document which params are multivalue
@@ -43, +39 @@

  Full details on the variety of complex expressions supported are explained in detail [[http://lucene.apache.org/solr/api/org/apache/solr/util/doc-files/min-should-match.html|here]].
  
  The default value is 100% (all clauses must match)
+ 
+ In Solr 1.4 and prior, you should basically set mm=0 if you want the equivilent of q.op=OR, and mm=100% if you want the
+ equivilent of q.op=AND.
  
  === pf (Phrase Fields) ===
  Once the list of matching documents has been identified using the "fq" and "qf" params, the "pf" param can be used to "boost" the score of documents in cases where all of the terms in the "q" param appear in close proximity.
@@ -77, +76 @@

  /!\ 1.4 best practice:  Solr 1.4 best practice is to avoid rord. For date boosting, use recip(ms(NOW,mydatefield),3.16e-11,1,1) or similar. See [[FunctionQuery|show more recent documents first]], specifically '''recip''', '''ms''' and '''Date Boosting''' sections.
  
  == Examples ==
- 
  /!\ :TODO: /!\ cleanup and expand examples
  
  Search across multiple fields, specifying (via boosts) how important each field is relative each other
+ 
  {{{
  http://localhost:8983/solr/select/?q=video&defType=dismax&qf=features^20.0+text^0.3
  }}}
+ You can boost results that have a field that matches a specific value...
  
- You can boost results that have a field that matches a specific value...
  {{{
  http://localhost:8983/solr/select/?q=video&defType=dismax&qf=features^20.0+text^0.3&bq=cat:electronics^5.0
  }}}
+ Using the "mm" param, 1 and 2 word queries require that all of the optional clauses match, but for queries with three or more clauses one missing clause is allowed...
  
- 
- Using the "mm" param, 1 and 2 word queries require that all of the optional clauses match, but for queries with three or more clauses one missing clause is allowed...
  {{{
  http://localhost:8983/solr/select/?q=belkin+ipod&defType=dismax&mm=2
  http://localhost:8983/solr/select/?q=belkin+ipod+gibberish&defType=dismax&mm=2

Re: [Solr Wiki] Trivial Update of "DisMaxQParserPlugin" by Bill Bell

Posted by Bill Bell <be...@comcast.net>.
Well, I read that documentation like 20 times and it never dawned on me
that mm=0% was an OR...  I should take my meds :)

I don't think it hurts anything to have another example in there. I will
add the reverse logic in there.


On 2/5/11 8:50 PM, "Chris Hostetter" <ho...@fucit.org> wrote:

>
>: This makes it sound like it's different after Solr 1.4
>
>it is ... in 3x and trunk the default value of mm is dictated by the q.op
>param (q.op=AND => mm=100%; q.op=OR => mm=0%)
>
>
>-Hoss
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>For additional commands, e-mail: dev-help@lucene.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: [Solr Wiki] Trivial Update of "DisMaxQParserPlugin" by Bill Bell

Posted by Chris Hostetter <ho...@fucit.org>.
: This makes it sound like it's different after Solr 1.4

it is ... in 3x and trunk the default value of mm is dictated by the q.op 
param (q.op=AND => mm=100%; q.op=OR => mm=0%)


-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: [Solr Wiki] Trivial Update of "DisMaxQParserPlugin" by Bill Bell

Posted by Yonik Seeley <yo...@lucidimagination.com>.
>  The default value is 100% (all clauses must match)
> +
> + In Solr 1.4 and prior, you should basically set mm=0 if you want the equivilent of q.op=OR, and mm=100% if you want the
> + equivilent of q.op=AND.

This makes it sound like it's different after Solr 1.4
I'm not sure there was a problem with this existing specific
documentation... wasn't the issue that the user (that prompted this
edit) wasn't aware of the existence of the mm parameter?

-Yonik
http://lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org