FAQ
I thought a bit about this when I revised the search code last year.
Before that, Similarity was global: there was only one implementation.
I could think of cases where it might make sense to have it per-query,
but that also seemed too fine-grained, so I opted to make it
per-searcher. But perhaps it really *should* be possible to specify a
different Similarity implementation for different queries.

Here's a proposal. We add a method to Query as follows:

public Query#getSimilarity(Searcher searcher) {
return searcher.getSimilarity();
}

Then change all of the Weight and Scorer code to call this in place of
Searcher#getSimilarity(). This permits one to subclass a Query class so
that it can specify it's own Similarity implementation, perhaps one that
delegates through that of the Searcher.

Comments?

Doug

Julien Nioche wrote:
Just a question :
Classes implementing MultiTermQuery (i-e WildcardQuery and FuzzyQuery) are
changed into BooleanQueries by the 'rewrite()' method before a Search. The
default coord() method of Similarity implies that the score of this BQ is
multiplied by the (ratio number of Terms found / number of terms searched).

This is fine but it could penalize the score of a document in case a Term
expands a lot. It's still possible to write your own Similarity class but
anyway the coord() method will be the same for all *Scorer objects and the
problem is that I'd like to keep the default behaviour for the "regular"
BooleanQueries.

The question is : how can I do to have 2 different ways to compute the coord
factor or to say differently how can I choose to use it or not without
having to rewrite a whole bunch of Query and Scorer objects? Would it be
useful in general? Any ideas?

Thanks

Julien





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


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

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupdev @
categorieslucene
postedFeb 2, '04 at 1:10p
activeFeb 5, '04 at 9:43p
posts2
users2
websitelucene.apache.org

2 users in discussion

Doug Cutting: 1 post Julien Nioche: 1 post

People

Translate

site design / logo © 2021 Grokbase