You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mekin Maheshwari <me...@gmail.com> on 2007/02/12 08:53:06 UTC

using DisjunctionMaxQuery

I am trying to use org.apache.lucene.search.DisjunctionMaxQuery

First, a quick check on how to use it.
I tried looking for javadocs, and the mailing list archive, but could not
find much.
Here is what I am doing :

//finalquery is a boolean query, that has a lot of field specific
sub-queries, each with a different boost, added to it

                        DisjunctionMaxQuery disMaxQuery = new
DisjunctionMaxQuery(0.1f);
                        disMaxQuery.add(finalQuery);
......
                        hits = searcher.search(disMaxQuery);


The only difference in the query.toString that I see when I print the
finalQuery & disMaxQuery is 2 additional sets of enclosing parentheses
followed by "~0.1"

When I search, I still see the same term being matched in multiple fields in
the explain output.

I tried setting the tieBreakerMultiplier to 0 and that does not change this
behaviour
I am guessing I am not using DisMaxQuery correctly
Should I be adding the individual Boolean sub-queries to the disMaxQuery ?

Thanks,
mekin.

Re: using DisjunctionMaxQuery

Posted by Chris Hostetter <ho...@fucit.org>.
: First, a quick check on how to use it.
: I tried looking for javadocs, and the mailing list archive, but could not
: find much.

the javadocs seem pretty clear to me...

"A query that generates the union of documents produced by its subqueries,
and that scores each document with the maximum score for that document as
produced by any subquery, plus a tie breaking increment for any additional
matching subqueries."


It's not really clear to me what exactly you are doing, but pased on this
comment...

: Should I be adding the individual Boolean sub-queries to the disMaxQuery ?

...DisjunctionMaxQuery is definitely intended for you to be adding
multiple sub-queries directly to it -- if you only add() one Query to your
disMaxQuery then it's effectively a No-Op.

: When I search, I still see the same term being matched in multiple fields in
: the explain output.

for the record: an Explanation for a DisjunctionMaxQuery is still going to
show you the term being matched in all of those fields -- but it's also
going to make it clear that the score is the max + the tiebreaker times
the sum of the others.  (even if tieBreakerMultiplier is 0, you'll still
see all of hte other subqueries in the Explanation)

if you have suggestions on improving the javaocs, by all means please open
a Jira issue and submit your suggestions there -- Users who struggle with
the existing documentation are the best source of better documentation.



-Hoss


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