Displaying 2 results from an estimated 2 matches for "kbar".
Did you mean:
bar
2015 Dec 28
3
synonym expansion for boolean prefixes.
...epending on
some kind of configuration.
Please CC me on any replies, I'm not subscribed to the list.
######################################################################
import xapian
db=xapian.WritableDatabase("db",xapian.DB_CREATE_OR_OPEN)
db.add_synonym("Kfoo","Kbar")
db.commit();
qp = xapian.QueryParser()
qp.set_database(db);
# replacing add_prefix with add_boolean_prefix stops synonym expansion, tested with 1.2.21
qp.add_prefix("tag","K")
query=qp.parse_query("tag:foo",xapian.QueryParser.FLAG_AUTO_SYNONYMS)
print quer...
2016 Jan 05
0
synonym expansion for boolean prefixes.
...FieldProcessor - you set one for
a prefix and the it gets passed the value and returns a Query object
for it. E.g. in lua (where you can just pass an anon function for the
FieldProcessor - we ought to support C++11 lambdas for such things):
require "xapian"
foo_tag_term = "Kbar"
qp = xapian.QueryParser()
qp:add_boolean_prefix("tag",
function (x)
if x == "foo" then
return xapian.Query(foo_tag_term)
end
return xapian.Query("K" .. x)
end)
print(qp:parse_query("tag:foo tag:x"))
Which parses to giv...