mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib: fix an exclude bug
When the exclude tags contain a tag that does not occur anywhere in the Xapian database the exclusion fails. We modify the way the query is constructed to `work around' this. (In fact the new code is cleaner anyway.) It also seems to fix another exclusion failure bug reported by jrollins but we have not yet worked out why it helps in that case.
This commit is contained in:
parent
1351aafac1
commit
c695534df5
1 changed files with 3 additions and 2 deletions
|
@ -219,13 +219,14 @@ notmuch_query_search_messages (notmuch_query_t *query)
|
||||||
|
|
||||||
if (query->exclude_terms) {
|
if (query->exclude_terms) {
|
||||||
exclude_query = _notmuch_exclude_tags (query, final_query);
|
exclude_query = _notmuch_exclude_tags (query, final_query);
|
||||||
exclude_query = Xapian::Query (Xapian::Query::OP_AND,
|
|
||||||
exclude_query, final_query);
|
|
||||||
|
|
||||||
if (query->omit_excluded_messages)
|
if (query->omit_excluded_messages)
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
||||||
final_query, exclude_query);
|
final_query, exclude_query);
|
||||||
else {
|
else {
|
||||||
|
exclude_query = Xapian::Query (Xapian::Query::OP_AND,
|
||||||
|
exclude_query, final_query);
|
||||||
|
|
||||||
enquire.set_weighting_scheme (Xapian::BoolWeight());
|
enquire.set_weighting_scheme (Xapian::BoolWeight());
|
||||||
enquire.set_query (exclude_query);
|
enquire.set_query (exclude_query);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue