DisMax handler and single-word phrase queries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DisMax handler and single-word phrase queries

Mike Klaas
Hello,

If you pass a single-word querystring to dismax, it constructs a
DisjunctionMax query with a clause for the main query, as well as a
clause for the "phrase" boost of the single word.  This causes an
effective doubling of the score for fields which are in both qf and
pf.

This can be corrected on the client side by conditionally unsetting pf
for single-word queries, but I was curious if this is a situation that
dismax might want to detect.

The main difficulty from my perspective is that a single word query
can expand to multiple terms after analysis...

cheers,
-Mike
Reply | Threaded
Open this post in threaded view
|

Re: DisMax handler and single-word phrase queries

Chris Hostetter-3

This is something i really went back and forth on when i was first
developing DisMax ... I initially assumed it would make sense to ignore
the pf for single word queries, but for a variety of reasons i don't
really remember in depth i decided that was a bad idea.  i think one of
the reasons was that without the pf clause contributing to the score, it
was hard to pick boost values and numeric constants in the bq and bf
params that would work for both single word and phrase queries.

what i tend to do with various indexes is some combination of:
  1) make sure the qf and pf boosts of any fields which are in both
     params take into consideration that the field is in both, and
     shouldn't be as high as a field in only one.
  2) make the pf boosts significantly greater then the qf boosts (which
     tends to make sense if you think about it)
  3) minimize the number of fields in both the qf and the pf ... in many
     cases it makes sense to have one or two amalgamated fields in the qf,
     but lots of specificfields in the pf.

As you oint out: different analyzers for differnet fields can make "I-Pod"
a term query on some fields, and a phrase queryon others -- which makes
changing the query structure problamatic.

: Date: Mon, 30 Oct 2006 17:39:00 -0800
: From: Mike Klaas <[hidden email]>
: Reply-To: [hidden email]
: To: [hidden email]
: Subject: DisMax handler and single-word phrase queries
:
: Hello,
:
: If you pass a single-word querystring to dismax, it constructs a
: DisjunctionMax query with a clause for the main query, as well as a
: clause for the "phrase" boost of the single word.  This causes an
: effective doubling of the score for fields which are in both qf and
: pf.
:
: This can be corrected on the client side by conditionally unsetting pf
: for single-word queries, but I was curious if this is a situation that
: dismax might want to detect.
:
: The main difficulty from my perspective is that a single word query
: can expand to multiple terms after analysis...
:
: cheers,
: -Mike
:



-Hoss