[Xapian-discuss] Re: I need a functionset_sort_by_relevance_then_value()

Olly Betts olly at survex.com
Fri Mar 3 16:57:18 GMT 2006


On Fri, Mar 03, 2006 at 08:09:50PM +0900, Sungsoo Kim wrote:
> I can set weighting scheme to ignore document length by setting a paramter
> such as BM25Weight(0,0,0,0,0).

Yes, that'll work, though you only need to set k2 and b to 0 to ignore
document length (and then the last parameter becomes irrelevant so might
as well be zero too).  So BM25Weight(1,0,1,0,0) is fine too, and takes
into account how many times each term occurs in the query and the
document, so will probably give better ranking of results.

> And I will try to modify some functions like
> msetcmp_sort_forward_relevance() in multimatch.cc file in order to get
> search results what I want.

Yes, that's the place to change.

> I hope you add the function set_sort_by_relevance_then_value() in the
> future version of xapian if you think there will be any possibility that the
> function can be used by other people.

If you can supply a suitable patch I can apply it.  It really needs a
matching feature test so we can be confident that it works and will
continue to work.  The example in your original message turned into code
would be fine I think.  Take a look at the existing test "sortrel1" (in
tests/api_db.cc) if you want a model to follow.

Cheers,
    Olly



More information about the Xapian-discuss mailing list