lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Help interpreting explanation
Date Mon, 06 Mar 2006 18:41:47 GMT

: Since i'm using a boolean OR query i figured it must be related to the
: BooleanScorer (though there's a more complicated BooleanScorer2 which
: I'm not sure when it's use).

There's actually three possible scorers used: ConjunctionScorer can be
used if all of the clauses are required.  Most of the behavior is driven
based on wether or not BooleanQuery.setUseScorer14(true) -- by default it
is false, which means BooleanScorer2 is used.

: But, I would appreciate if someone could point me to the method where
: the searcher iterates over all query terms and outputs the score. I grep
:   both the Searcher classes and the BooleanScorer classes but can't find it.

the searcher doesn't really iterate over query terms, it knows about one
and only one Weight, and it asks that Weight instance to give it a Scorer
for the current index, and then it asks that Scorer to iterate over the
documents and tell it which ones match (using the score(HitCollector)
method).  Internally, the Scorer iterates over the matching documents
using the to next(), doc()" and score() methods.

When you are searching for a single Term, the Scorer involved is
TermScorer; when you are seraching for many terms, the Scorer involved is
(usually) a BooleanScorer2.   BooleanScorers are complicated because they
are juggling a lot of things at once keeping track of which of the Scorers it
contains has the lowest "next" doc, but if you look at TermWeight and
TermScorer you'll get a pretty good idea of how the various similarity
methods are used.

: Also, I would like to know whether will the sloppyFreq "kick in" if I'm
: just using a Boolean OR query or is this only for phrase queries? And
: how do I disable this so that it'll always be 1.0 without overwriting
: the method?

as it says in the javadocs "amount of a sloppy phrase match..." ... only
for phrase queries (or phrase like queries, ie: SpanNear)

In general, the only way to change the implimentation of a Similarity
method used for all queries is to write your own Similarity class, and use
the Similarity.setDefault or Searcher.setSimilarity methods to "register"
it.

If you really only one type of query (or one instance of a query object)
to get a different similarity, you can override the getSimiliarty() method
in the Query class in question, and use the SimilarityDelegator to wrap
the default, and only change the methods you want to change.




-Hoss


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


Mime
View raw message