Created
December 28, 2016 17:00
-
-
Save jaylett/962d41538653e18a8735b33b8dd0d625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import xapian | |
if len(sys.argv) == 0: | |
queries = [ 'tag:new tag:lsc' ] | |
else: | |
queries = list(sys.argv) | |
qp = xapian.QueryParser() | |
qp.add_prefix("tag", "K") | |
for query in queries: | |
qp.set_default_op(xapian.Query.OP_OR); | |
print("Default OR [%s]:" % query, str(qp.parse_query(query))) | |
qp.set_default_op(xapian.Query.OP_AND); | |
print("Default AND [%s]:" % query, str(qp.parse_query(query))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment