From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [WIP 2/2] cli: search: multithread
Date: Tue, 20 Mar 2012 20:12:00 +0000 [thread overview]
Message-ID: <1332274320-17487-3-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com>
---
notmuch-search.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/notmuch-search.c b/notmuch-search.c
index f6061e4..2fa4231 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -436,6 +436,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
int offset = 0;
int limit = -1; /* unlimited */
notmuch_bool_t no_exclude = FALSE;
+ notmuch_bool_t secondary_search = FALSE;
+ char *secondary_search_terms = NULL;
+ notmuch_ss_conjunction_t ss_conjunction = NOTMUCH_SECONDARY_SEARCH_NONE;
unsigned int i;
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
@@ -458,6 +461,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
{ "tags", OUTPUT_TAGS },
{ 0, 0 } } },
{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
+ { NOTMUCH_OPT_BOOLEAN, &secondary_search, "secondary-search", 'd', 0 },
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
{ 0, 0, 0, 0, 0 }
@@ -478,6 +482,18 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
break;
}
+ if (secondary_search && argc-opt_index >= 2 ) {
+ if (strcmp (argv[argc - 2], ":AND:") == 0)
+ ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND;
+ if (strcmp (argv[argc - 2], ":AND_NOT:") == 0)
+ ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND_NOT;
+
+ if (ss_conjunction != NOTMUCH_SECONDARY_SEARCH_NONE) {
+ secondary_search_terms = argv[argc - 1];
+ argc -= 2;
+ }
+ }
+
config = notmuch_config_open (ctx, NULL, NULL);
if (config == NULL)
return 1;
@@ -505,6 +521,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
notmuch_query_set_sort (query, sort);
+ if (secondary_search_terms)
+ notmuch_query_set_secondary_search (query, secondary_search_terms, ss_conjunction);
+
if (!no_exclude) {
const char **search_exclude_tags;
size_t search_exclude_tags_length;
--
1.7.9.1
next prev parent reply other threads:[~2012-03-20 20:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 20:11 [WIP 0/2] Thread based searching Mark Walters
2012-03-20 20:11 ` [WIP 1/2] lib: multithread Mark Walters
2012-03-20 20:12 ` Mark Walters [this message]
2012-04-14 19:15 ` [WIP 0/2] Thread based searching Jameson Graef Rollins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332274320-17487-3-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).