Re: Omega: Missing support for newer weighting schemes
Vivek Pal <[email protected]> Mon, 10 Apr 2017 23:47:36 +0530
| Newsgroups | gmane.comp.search.xapian.devel |
|---|---|
| Message-ID | <CAGxcUfzw_qKfS9CmiWqeo+pKu9uPBFgLftThbCXbqgzvem+tSA@mail.gmail.com> |
> No, use Xapian::Registry to find the weighting scheme from the name > like how Weight::unserialise() does (otherwise every caller would need > code similar to that above). Okay, I looked into Xapian::Registry and it seems you are referring to using the get_weighting_scheme method? (which expects a string e.g. "bm25" i.e. the name of a weighting scheme.) And, Weight::unserialise() looks like throwing a Xapian::UnimplementedError error. I wonder if you meant the same method? > The code in omega would just be: > > enq.set_weighting_scheme(Xapian::Weight::parse_params(scheme)); I wonder if we could do something more like: enq.set_weighting_scheme(Xapian::Registry::get_weighting_scheme(name).parse_params(params)); where, Xapian::Registry::get_weighting_scheme(name) returns a weighting scheme object e.g. BM25Weight object and then calling parse_params method on that to return a BM25Weight object now with parameters values as found in params string. It should work given that we first separate the "scheme" string into two substrings namely "name" and "params" as used above. Also, we'd check if params is not null e.g. in the case of scheme = "bm25" and then we'd just call: enq.set_weighting_scheme(Xapian::Registry::get_weighting_scheme(name)); Also, regarding Xapian::Weight::parse_params(scheme) -- I thought we were to define parse_params method in each Weight subclass e.g. BM25Weight, LMWeight etc.? > There's probably a much better name than parse_params() though. Yes, I agree. May be get_parameterized_weighting_scheme sound better? (if it isn't too long to read :)) Thanks, Vivek