>From the javadocs for the search with sort method it appears you are calling:
NOTE: this does not compute scores by default; use IndexSearcher.setDefaultFieldSortScoring(boolean, boolean) to enable scoring. Sounds like you need to call that with at least the first arg set to true. -- Ian. On Fri, Mar 5, 2010 at 9:13 AM, gabriele renzi <rff....@gmail.com> wrote: > Hi everyone, > > In our search app we'd perform searches with a DisjunctionMaxQuery > with code like > > searcher.search(query, 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 > > searcher.search(query, null, hits, new Sort(SortField.SCORE_FIELD, > new CustomSortField()) > > but I had unexpected results, so I dropped our custom SortField, and > tried the simple > > searcher.search(query, 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: http://www.riffraff.info > blog it: http://riffraff.blogsome.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org