synonym expansion for boolean prefixes.
David Bremner
david at tethera.net
Mon Dec 28 03:24:36 GMT 2015
I have an application for synonyms for tags in in notmuch, which means
synonym expansion for a particular boolean prefix. I have a vague memory
of Olly telling me this doesn't work, but I'm not sure about the
details.
My higher level goal is to support a kind of indirection with tags,
where query tag:foo can really generate tag:bar or tag:fub, depending 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 query;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 647 bytes
Desc: not available
URL: <http://lists.xapian.org/pipermail/xapian-discuss/attachments/20151227/13a23af9/attachment.sig>
More information about the Xapian-discuss
mailing list