Displaying 2 results from an estimated 2 matches for "final_query".
2018 Aug 09
2
Boosted fields search in Python
Hi,
I'm using Xapian in Python2. I'm trying to replicate an analysis that
somebody else performed in Lucene. To do that I need to do a search for a
multi-word query in which particular fields are boosted - preferably at
query time. That is, given a query like "the cat is lying on the mat" (with
an OR operator, ignoring word positions but with stemming and stop words
removed),
2018 Aug 09
0
Boosted fields search in Python
...inally you need to combine the two weighted queries. You can do this using OP_OR, which will rank higher a document where both the title and the body match. Alternatively, OP_MAX may work better (use whichever side ranks higher, which will probably be the higher-weighted one). Something like this:
final_query = xapian.Query(xapian.Query.OP_MAX, [weighted_title_query, weighted_body_query])
(Note that boosting title to 4 and body to 2 probably isn't better than just boosting title to 2 and leaving body at standard weighting. Of course if you have a more complex search structure going on then that may...