Arjen van der Meijden
2006-Nov-13 13:15 UTC
[Xapian-discuss] Is there a secondary sorting possible for relevance-sorts?
Hi list, When doing a default relevance-based sorting of the search results in a xapian+omega combination, it appears in our results that for similar relevances the older records are shown first and then the newer ones... For a forum this probably isn't the best behaviour, newer discussions are at least kept with more up-to-date insight on the matter at hand. So if an old and a new discussion have the same relevance, the newer should be preferred. The sort-bands functionality in omega could probably have done this, but that doesn't exist (anymore? or had it never really?). Is my assumption about the "secondary" ordering correct? And is there an option to get the desired behaviour with Omega? In a sql-like environment I'd use something like: ORDER BY relevance DESC, updatetime DESC (highest relevance first, when same relevance, newest item first). Best regards, Arjen
Olly Betts
2006-Nov-13 16:11 UTC
[Xapian-discuss] Is there a secondary sorting possible for relevance-sorts?
On Mon, Nov 13, 2006 at 02:08:19PM +0100, Arjen van der Meijden wrote:> Is my assumption about the "secondary" ordering correct? And is there an > option to get the desired behaviour with Omega?You either want: Xapian::Enquire::set_sort_by_relevance_then_value(VALUE); or: Xapian::Enquire::set_docid_order(Xapian::Enquire::DESCENDING); The later is cheaper, but sorts by the document id for documents with equal relevance, which is will generally favour newer discussions over older ones because older ones will have been indexed before newer ones. But it's problematic if a full reindex is done and documents added in arbitrary order. You can't currently access either from Omega, but that probably should be fixed. Cheers, Olly