lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "DisMaxRequestHandler" by HossMan
Date Fri, 30 Jul 2010 01:58:39 GMT
Dear Wiki user,

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

The "DisMaxRequestHandler" page has been changed by HossMan.
The comment on this change is: purging content that has been migrated to DisMaxQParserPlugin.
http://wiki.apache.org/solr/DisMaxRequestHandler?action=diff&rev1=29&rev2=30

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

- The DisMaxRequestHandler is designed to process simple user entered phrases (without heavy
syntax) and search for the individual words across several fields using different weighting
(boosts) based on the significance of each field.  Additional options let you influence the
score based on rules specific to each use case (independent of user input)
+ The DisMaxRequestHandler (aka : DisMax) was designed to process simple user entered phrases
(without heavy syntax) and search for the individual words across several fields using different
weighting (boosts) based on the significance of each field.  Additional options let you influence
the score based on rules specific to each use case (independent of user input)
  
- '''NOTE:''' As of Solr 1.3, the DisMaxRequestHandler is the exact same thing as the SearchHandler
with the default query parser set to the !DisMax Query Parser (defType=dismax).
+ As of Solr 1.3, the DisMaxRequestHandler is the exact same thing as the SearchHandler with
the default query parser set to the [[DisMaxQParserPlugin]] (defType=dismax).
  
+ If you found a link to this page somewhere, you most likely want to be reading these pages
instead:
+    * DisMax (for background information on the concepts)
+    * [[DisMaxQParserPlugin]] (for details on dismax syntax and request parameters)
- '''NOTE:''' Please refer to this component as Dismax Query Parser, '''not''' DisMaxRequestHandler
- 
- '''NOTE:''' Post Solr 1.4 there will be an Extended DisMax parsing that will improve punctuation
handling and relevancy calculations, among other things.  It may be called '''edismax'''.
 See JIRA [[http://issues.apache.org/jira/browse/SOLR-1553|SOLR-1553]]
- 
- /!\ :TODO: /!\ rework this into a wiki page about DisMasQParserPlugin
- 
- <<TableOfContents>>
- 
- == Overview ==
- This query handler 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.
- 
- == Parameters ==
- In addition to the CommonQueryParameters, HighlightingParameters, and SimpleFacetParameters
the !DisMax Request Handler supports  the following Parameters.  Default parameter values
to be specified in solrconfig.xml, or overridden by query-time values in the request (just
like StandardRequestHandler)
- 
- /!\ :TODO: /!\ double check that we aren't still missing some params
- 
- /!\ :TODO: /!\ document which params are multivalue
- 
- === q ===
- The guts of the search defining the main "query".  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 in this "q" parameter
are not supported.
- 
- === q.alt ===
- If specified, this query will be used (and parsed by default using standard query parsing
syntax) when the main q parameter is not specified or blank.  This comes in handy when you
need something like a match-all-docs query (don't forget &rows=0 for that one!) in order
to get collection-wise faceting counts.
- 
- === qf (Query Fields) ===
- List of fields and the "boosts" to associate with each of them when building !DisjunctionMaxQueries
from the user's query.  The format supported is {{{fieldOne^2.3 fieldTwo fieldThree^0.4}}},
which indicates that fieldOne has a boost of 2.3, fieldTwo has the default boost, and fieldThree
has a boost of 0.4 ... this indicates that matches in fieldOne are much more significant than
matches in fieldTwo, which are more significant than matches in fieldThree.
- 
- === mm (Minimum 'Should' Match) ===
- When dealing with queries there are 3 types of "clauses" that Lucene knows about: mandatory,
prohibited, and 'optional' (aka: "SHOULD")  By default all words or phrases specified in the
"q" param are treated as "optional" clauses unless they are preceeded by a "+" or a "-". 
 When dealing with these "optional" clauses, the "mm" option makes it possible to say that
a certain minimum number of those clauses must match (mm).  Specifying this minimum number
can be done in complex ways, equating to ideas like...
- 
-  * At least 2 of the optional clauses must match, regardless of how many clauses there are:
"{{{2}}}"
-  * At least 75% of the optional clauses must match, rounded down: "{{{75%}}}"
-  * If there are less than 3 optional clauses, they all must match; if there are 3 or more,
then 75% must match, rounded up: "{{{2<-25%}}}"
-  * If there are less than 3 optional clauses, they all must match; for 3 to 5 clauses, one
less than the number of clauses must match, for 6 or more clauses, 80% must match, rounded
down:  "{{{2<-1 5<80%}}}"
- 
- 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)
- 
- === 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.
- 
- The format is the same as the "qf" param: a list of fields and "boosts" to associate with
each of them when making phrase queries out of the entire "q" param.
- 
- === ps (Phrase Slop) ===
- Amount of slop on phrase queries built for "pf" fields (affects boosting).
- 
- === qs (Query Phrase Slop) ===
- Amount of slop on phrase queries explicitly included in the user's query string (in qf fields;
affects matching).  <!> [[Solr1.3]]
- 
- === tie (Tie breaker) ===
- Float value to use as tiebreaker in !DisjunctionMaxQueries (should be something much less
than 1)
- 
- When a term from the users input is tested against multiple fields, more than one field
may match and each field will generate a different score based on how common that word is
in that field (for each document relative to all other documents).  The "tie" param let's
you configure how much the final score of the query will be influenced by the scores of the
lower scoring fields compared to the highest scoring field.
- 
- A value of "0.0" makes the query a pure "disjunction max query" -- only the maximum scoring
sub query contributes to the final score.  A value of "1.0" makes the query a pure "disjunction
sum query" where it doesn't matter what the maximum scoring sub query is, the final score
is the sum of the sub scores.  Typically a low value (ie: 0.1) is useful.
- 
- === bq (Boost Query) ===
- A raw query string (in the SolrQuerySyntax) that will be included with the user's query
to influence the score.  If this is a !BooleanQuery with a default boost (1.0f) then the individual
clauses will be added directly to the main query. Otherwise, the query will be included as
is.
- 
- /!\ :TODO: /!\  That latter part is deprecated behavior but still works.  It can be problematic
so avoid it.
- 
- === bf (Boost Functions) ===
- [[FunctionQuery|Functions]] (with optional boosts) that will be included in the user's query
to influence the score.  Any function supported natively by Solr can be used, along with a
boost value, e.g.: recip(rord(myfield),1,2,3)^1.5
- 
- Specifying functions with the "bf" param is just shorthand for using the {{{_val_:"...function..."}}}
syntax in a "bq" param.
- 
- For example, if you want to [[FunctionQuery|show more recent documents first]], use recip(rord(creationDate),1,1000,1000)
- 
- == Examples ==
- /!\ :TODO: /!\ cleanup and expand examples
- 
- {{{
- Normal results for the word "video" using the StandardRequestHandler with
- the default search field...
-   http://localhost:8983/solr/select/?q=video&fl=name+score&qt=standard
- 
- The "dismax" handler is configured to search across the text, features,
- name, sku, id, manu, and cat fields all with varying boosts designed to
- ensure that "better" matches appear first, specifically: documents which
- match on the name and cat fields get higher scores...
-   http://localhost:8983/solr/select/?q=video&qt=dismax
- 
- ...note that this instance is also configured with a default field list,
- which can be overridden in the URL...
-   http://localhost:8983/solr/select/?q=video&qt=dismax&fl=*,score
- 
- You can also override which fields are searched on and how much boost
- each field gets...
-   http://localhost:8983/solr/select/?q=video&qt=dismax&qf=features^20.0+text^0.3
- 
- You can boost results that have a field that matches a specific value...
-   http://localhost:8983/solr/select/?q=video&qt=dismax&bq=cat:electronics^5.0
- 
- Another instance of the handler is registered using the qt "instock" and
- has slightly different configuration options, notably: a filter for (you
- guessed it) inStock:true)...
-   http://localhost:8983/solr/select/?q=video&qt=dismax&fl=name,score,inStock
-   http://localhost:8983/solr/select/?q=video&qt=instock&fl=name,score,inStock
- 
- One of the other really cool features in this handler is robust
- support for specifying the "BooleanQuery.minimumNumberShouldMatch" you
- want to be used based on how many terms are in your user's query.
- These allows flexibility for typos and partial matches.  For the
- dismax handler, 1 and 2 word queries require that all of the optional
- clauses match, but for 3-5 word queries one missing word is allowed...
-   http://localhost:8983/solr/select/?q=belkin+ipod&qt=dismax
-   http://localhost:8983/solr/select/?q=belkin+ipod+gibberish&qt=dismax
-   http://localhost:8983/solr/select/?q=belkin+ipod+apple&qt=dismax
- 
- Just like the StandardRequestHandler, it supports the debugQuery
- option to viewing the parsed query, and the score explanations for each
- doc...
-   http://localhost:8983/solr/select/?q=belkin+ipod+gibberish&qt=dismax&debugQuery=true
-   http://localhost:8983/solr/select/?q=video+card&qt=dismax&debugQuery=true
- }}}
- == 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.
  
  ----
  CategorySolrRequestHandler

Mime
View raw message