lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gabriele renzi <>
Subject DisjunctionMaxQuery and custom Sort
Date Fri, 05 Mar 2010 09:13:52 GMT
Hi everyone,

In our search app we'd perform searches with a DisjunctionMaxQuery
with code like, hits)

Now we'd like to add a custom sub-sort so that when the search returns
two documents with the same score they will be ordered by a custom
field (this is not a boost for two reasons: first,  we already use
boosting for other goals, second, we may like to add a third level of
boosting in the future)

I thought I could just change the former line to something like, null, hits, new Sort(SortField.SCORE_FIELD,
new CustomSortField())

but I had unexpected results, so I dropped our custom SortField, and
tried the simple, null, hits, new Sort(SortField.SCORE_FIELD))

which I though should have the same behaviour of our original code:
yet, a large part of our tests failed because it appears that the
results are not the same as above.

So my question is threefold:
1. is the last query really not functionally equivalent to the first?
2. if not, how would the equivalent be?
3. and how can I perform a sub-sorting of the results by relevance
first and my custom score field later?

FWIW I am using lucene 2.9.1, java 1.6, OSX 10.6. Thanks in advance
for any help.

blog en:
blog it:

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

View raw message