Lasse, On Friday 11 November 2005 19: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.
There is no way around using a separate Scorer for this. You can make (could have made) the scorer by starting from DisjunctionSumScorer.java here: http://svn.apache.org/viewcvs.cgi/lucene/java/trunk/src/java/org/apache/lucene/search/ and rewrite it into a DisjunctionMaxScorer. You can extend QueryParser by subclassing it and override getBooleanQuery() to use your query when the first clause equals for example '_max' and all other clauses are optional. Regards, Paul Elschot --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]