Omega: Missing support for newer weighting schemes
Vivek Pal
vivekpal.dtu at gmail.com
Sun Apr 9 19:04:07 BST 2017
> Each scheme already has a human-readable name, and Xapian::Registry
> can map that to an "examplar" object of the right type, so we
> could take a string like "bm25 1 0.8", see the first word is "bm25"
> and get a BM25Weight object, then call parse_params("1 0.8") on it to
> create the correct Weight object (broadly similar to how unserialise()
> is handled).
If I followed correctly, since the set_weighting_scheme method in
omega/weight.cc already does exactly that, do you suggest adding a
parse_params method in each weighting scheme class to create the specific
object? -- in which case the set_weighting_scheme method in omega/weight.cc
would then use parse_params method to create the specific object with params
in the "scheme" string. E.g. -
if (startswith(scheme, "bm25")) {
const char *p = scheme.c_str() + 4;
if (*p == '\0') {
enq.set_weighting_scheme(Xapian::BM25Weight());
return;
}
if (C_isspace(*p)) {
Xapian::BM25Weight wt = Xapian::BM25Weight::parse_params(p);
enq.set_weighting_scheme(wt);
return;
}
}
I didn't test the code above so there could be small errors, but
hopefully it gets
across the general idea.
Thanks,
Vivek
More information about the Xapian-devel
mailing list