summaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2016-01-01 22:07:42 -0800
committerDavid Bremner <david@tethera.net>2016-03-24 07:39:42 -0300
commit6c0b6c8e1c4a8ab139db3cadee26d05962c3ce2c (patch)
tree6a172046a623419fb740b703c4f0e3dac7880a6b /devel
parent031ca3f1bdb5e9edb9fc21779149bdfcb554a83f (diff)
nmbug-status: Wrap query phrases in parentheses when and-ing together
For example: "query": ["tag:a", "tag:b or tag:c"] is now converted to: ( tag:a ) and ( tag:b or tag:c ) instead of the old: tag:a and tag:b or tag:c This helps us avoid confusion due to Xapian's higher-precedence AND [1], where the old query would be interpreted as: ( tag:a and tag:b ) or tag:c [1]: http://xapian.org/docs/queryparser.html
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/nmbug/nmbug-status5
1 files changed, 3 insertions, 2 deletions
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 9de80d36..94be6717 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -167,7 +167,8 @@ class Page (object):
view['title'], sort_key))
if 'query-string' not in view:
query = view['query']
- view['query-string'] = ' and '.join(query)
+ view['query-string'] = ' and '.join(
+ '( {} )'.format(q) for q in query)
q = notmuch.Query(database, view['query-string'])
q.set_sort(sort)
threads = self._get_threads(messages=q.search_messages())
@@ -421,7 +422,7 @@ if args.list_views:
elif args.get_query != None:
for view in config['views']:
if args.get_query == view['title']:
- print(' and '.join(view['query']))
+ print(' and '.join('( {} )'.format(q) for q in view['query']))
sys.exit(0)
else:
# only import notmuch if needed