[Xapian-discuss] Is there a secondary sorting possible for relevance-sorts?

Arjen van der Meijden acmmailing at tweakers.net
Fri Nov 17 06:27:44 GMT 2006


On 17-11-2006 1:04 Olly Betts wrote:
> I'm assuming you mean x is some number, not a literal 'x'...
Of course.

> I can't really tell from your description if this is working or not.
> Here's a patch to add a new $weight command to OmegaScript to report the
> raw document weight:
Ok, for the descending docid-based sorting the results where:
id=555678 relevance=100%
id=367726 relevance=99%
id=114376 relevance=99%
id=1133305 relevance=99%
id=568327 relevance=99%
id=322967 relevance=99%
id=568521 relevance=99%
id=676121 relevance=99%
id=82322 relevance=99%
id=99419 relevance=98%
id=144406 relevance=98%
id=659769 relevance=98%

For reverse sorting on a value that represented the document's time:

id=555678 relevance=100%
id=367726 relevance=99%
id=114376 relevance=99%
id=1133305 relevance=99%
id=568327 relevance=99%
id=322967 relevance=99%
id=568521 relevance=99%
id=676121 relevance=99%
id=82322 relevance=99%
id=99419 relevance=98%
id=144406 relevance=98%
id=161937 relevance=98%

So the first difference started at the 12th item. Based on those 
relevances you wouldn't expect these 12 first results when doing a 
reverse secondary sort on that value:

id=1363 relevance=99%
id=6650 relevance=97%
id=642 relevance=95%
id=2517 relevance=92%
id=26611 relevance=89%
id=960 relevance=89%
id=3309 relevance=88%
id=466 relevance=88%
id=860 relevance=87%
id=2508 relevance=87%
id=2585 relevance=87%
id=424 relevance=86%

> http://www.oligarchy.co.uk/xapian/patches/omegascript-weight.patch
> 
> You can then add something like this to your query template and it
> should be clear if the sort order is correct:
> 
> $value{1} $weight $id
> 
> If you were hoping for more reordering of hits with apparently identical
> weights, the documentation comment for set_sort_by_relevance_then_value()
> might be helpful (this is what SORTAFTER=1 uses):

I'll have a look of the weight the documents got.

Best regards,

Arjen



More information about the Xapian-discuss mailing list