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

Sungsoo Kim xingshou at gmail.com
Mon Mar 6 16:36:06 GMT 2006


Hello, Olly!

>> 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.

Yes, you are right! The search results of BM25Weight(0,0,0,0,0) look
similar to BoolWeight() scheme because it ignores "within document
frequency". I followed your suggestion and it works very nice. Thanks!

>> 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.


Yes I will try, but it is not as simple as I expected. Maybe I need to add 
a boolean variable, and if new function is added the xapian-binding
modules also should be modified. So I wonder it would be better
that all of set_sort_by_*() functions merged into one function just like 
the deprecated set_sorting().


For better Xapian!


Sungsoo Kim


More information about the Xapian-discuss mailing list