Letor: returning MSet after re-ranking

Olly Betts olly at survex.com
Sun Jul 31 00:44:16 BST 2016


On Sun, Jul 31, 2016 at 03:49:05AM +0530, Ayush Tomar wrote:
> What would you suggest should be the way out to access MSet internals from
> -letor, if we can't add things to -core's public API?

I wouldn't say we can't add things to the core API, but it's much better
if additions are clean, somewhat minimal (adding a lot of new methods
and/or classes makes the API harder to learn and to work with, though
being overly minimal has its downsides too so there can be a balance to
strike on this), consistent with the existing API, and if possible have
more than a single use.

Would a method which swapped two elements of an MSet provide what you
need?  That would provide a more generic way to adjust the ranking of
an MSet which for example could be used to implement a diversification
feature or something like SQL "GROUP BY".

For example:

void MSet::exchange(Xapian::doccount a, Xapian::doccount b);

Perhaps with an overloaded form which takes two MSetIterator objects for
convenience.

Cheers,
    Olly



More information about the Xapian-devel mailing list