unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Allow lone "not" search operators
@ 2009-11-19  0:07 Adrian Perez
  2009-11-19  0:45 ` Carl Worth
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Perez @ 2009-11-19  0:07 UTC (permalink / raw)
  To: notmuch

As suggested by Keith in FLAG_PURE_NOT allows for expressions like:

  notmuch search NOT tag:inbox

Note that this way a search like:

  notmuch search foobar NOT tag:inbox

should not be written instead:

  notmuch search foobar AND NOT tag:inbox

In my opinion, the latter feels more natural and is somewhat more explicit.
It gives a better clue of what the search is about instead of assuming that
an implicit AND operator is there.

---
 lib/query.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index a869f3e..75f22b3 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -97,7 +97,8 @@ notmuch_query_search_messages (notmuch_query_t *query,
 			      Xapian::QueryParser::FLAG_PHRASE |
 			      Xapian::QueryParser::FLAG_LOVEHATE |
 			      Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
-			      Xapian::QueryParser::FLAG_WILDCARD);
+			      Xapian::QueryParser::FLAG_WILDCARD |
+			      Xapian::QueryParser::FLAG_PURE_NOT);
 
 	if (strcmp (query_string, "") == 0) {
 	    final_query = mail_query;
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Allow lone "not" search operators
  2009-11-19  0:07 [PATCH] Allow lone "not" search operators Adrian Perez
@ 2009-11-19  0:45 ` Carl Worth
  0 siblings, 0 replies; 2+ messages in thread
From: Carl Worth @ 2009-11-19  0:45 UTC (permalink / raw)
  To: Adrian Perez, notmuch

On Thu, 19 Nov 2009 01:07:22 +0100, Adrian Perez <aperez@igalia.com> wrote:
> As suggested by Keith in FLAG_PURE_NOT allows for expressions like:
> 
>   notmuch search NOT tag:inbox

Oh, fantastic! I guess I'd run into enough QueryParser bugs recently
that I was willing to blame it without cause this time.

And I *thought* I had looked carefully at all the QueryParser tags to
choose all the useful ones, but clearly I missed this one.

Anyway, thanks for the research and the fix. This is pushed now.

Happy hacking,

-Carl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-19  0:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19  0:07 [PATCH] Allow lone "not" search operators Adrian Perez
2009-11-19  0:45 ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).