lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Serebrennikov <>
Subject Re: Question: using boost for sorting
Date Wed, 16 Oct 2002 23:11:41 GMT
Also, please consider that some applications may require multiple 
Similarity implementations in the same index. For example, I would like 
to be able to sort by relevance on most searches, but sometimes allow 
users to request that results were ordered by price or by some other 
field. I think it would be ok to dedicate a special field for a given 
sort order, but requiring a whole new index is too much.


Doug Cutting wrote:

> Please submit diffs before committing anything, as this is delicate 
> code.  Small changes here can affect performance in a big way.
> Also, we must be extra-careful when making a new public API: once a 
> method is public it's very hard to remove it.  The Similarity methods 
> also need to be well documented.
> Doug
> Otis Gospodnetic wrote:
>> This sounds good to me, as it would lead us to pluggable similarity
>> computation...mmmm.
>> I can refactor some of this tonight.
>> Otis
>> --- Doug Cutting <> wrote:
>>> This looks like a good approach.  When I get a chance, I'd like to
>>> make Similarity an interface or an abstract class, whose default 
>>> implementation would do what the current class does, but whose
>>> methods can be overridden.  Then I'd add methods like:
>>>   public static void Similarity.setDefaultSimilarity(Similarity
>>> sim);
>>>   public void IndexWriter.setSimilarity(Similarity sim);
>>>   public void Searcher.setSimilarity(Similarity sim);
>>> So to override Similarity methods you'd define a subclass of the 
>>> standard implementation, then either install yours globally via 
>>> setDefaultSimilarity, or set it in your IndexWriter before adding 
>>> documents and in your Searcher before searching.  Does that sound 
>>> reasonable?
>>> This would let you do what you describe below without changing
>>> Lucene's sources.  However I'm very short on time right now and 
>>> don't know how
>>> soon I'll get to this.
>>> Doug

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message