mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 01:14:53 +01:00
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
This commit is contained in:
parent
031ca3f1bd
commit
6c0b6c8e1c
2 changed files with 6 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -4,6 +4,9 @@ Notmuch 0.22 (UNRELEASED)
|
|||
nmbug-status
|
||||
------------
|
||||
|
||||
`nmbug-status` now wraps query phrases in parentheses when and-ing
|
||||
them together, to avoid confusion about clause grouping.
|
||||
|
||||
`nmbug-status` now supports `meta.message-url` to override the Gmane
|
||||
template. For example, you can use:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue