lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Max score of two fields
Date Sat, 12 Nov 2005 00:57:21 GMT

On 11 Nov 2005, at 13:27, Lasse L wrote:
> I am indexing persons that has the usual fields name, address etc.
> I need to keep track of which name and addresses are active now and
> which ones are old.
> I do that by having a two sets of fields e.g.: current_name and  
> old_name
>
> When I search for a person and I search in just the current fields
> ranking is fine.
>
> When I search for a person in both the current and old fields at the
> same time the ranking gets skewed if some of the persons has
> registered the same or similar name and address in the past. In the
> current_name:Lars OR old_name:Lars the documents that match on both
> sides are ranked higher.
>
> I'd like the document to rank like the best/max score of either side
> of that subquery.
>
> I tried implementing my own Query, Weight and Scorer but it seemed
> like an overly complex way of doing it.
>
> Any suggestions?

I believe if you create a custom Similarity implementation (subclass  
DefaultSimilarity) and override coord() and return 1.0f from it you  
will achieve what you're after.  You'll need to register your custom  
implementation with your IndexSearcher and IndexWriter, but if you  
only change coord() there shouldn't be a need to reindex, but  
changing any other factors you should reindex.

     Erik



---------------------------------------------------------------------
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