Displaying 3 results from an estimated 3 matches for "op_scale_weight".
2018 Aug 09
2
Boosted fields search in Python
...the examples given to
Python
2. the examples are for boosting single terms, not fields and not
multiple-word queries
I have implemented a workaround that manually attaches prefixes to terms
and combines everything with an OR, like this:
subqueries = []
subqueries.extend([xapian.Query(xapian.Query.OP_SCALE_WEIGHT,
xapian.Query('S'+term), 4) for term in query_terms])
subqueries.extend([xapian.Query(xapian.Query.OP_SCALE_WEIGHT,
xapian.Query('XD'+term), 2) for term in query_terms])
query = xapian.Query(xapian.Query.OP_OR, subqueries)
However:
1. It seems overly complicated (and I'm not ev...
2018 Aug 09
0
Boosted fields search in Python
...getting started guide for a complete example.
# ...
# S = Subject. Note that you can't use a keyword argument for default_prefix, so we have
# to provide the flags as well.
title_query = queryparser.parse_query(querystring, xapian.QueryParser.FLAG_DEFAULT, "S")
Then you need to use OP_SCALE_WEIGHT, as you've identified, to apply the different weightings to the queries parsed against the two fields.
weighted_title_query = xapian.Query(xapian.Query.OP_SCALE_WEIGHT, title_query, 4)
Finally you need to combine the two weighted queries. You can do this using OP_OR, which will rank higher a...
2012 Jan 20
2
Perl version of sortable_serialize missing?
I attempted to use the sortable_serialize function from perl, however
doesn't seem to exist. The only occurrence of the string "sortable" in
the /usr/local/perl/5.10.1/Search/ tree is in the pod in Xapian.pm.
What am I doing wrong?
use Search::Xapian;
...
$doc->add_value(4,sortable_serialize($recdate));
Undefined subroutine &main::sortable_serialize called