aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO15
-rw-r--r--lib/database-private.h1
-rw-r--r--lib/database.cc3
-rw-r--r--notmuch.115
-rw-r--r--notmuch.c17
5 files changed, 46 insertions, 5 deletions
diff --git a/TODO b/TODO
index 7c984c2..65d6c75 100644
--- a/TODO
+++ b/TODO
@@ -4,11 +4,9 @@ Fix the things that are causing the most pain to new users
2. Allow an easy way to get tags from directory names (if the user has them)
-3. Allow an easy way to remove excess tags, (date-based search)
+3. Make emacs fast for big search results (see "lazy searching" below)
-4. Make emacs fast for big search results (see "lazy searching" below)
-
-5. Fix Xapian defect #250 so tagging is fast.
+4. Fix Xapian defect #250 so tagging is fast.
Emacs interface (notmuch.el)
----------------------------
@@ -112,6 +110,15 @@ indexing.
notmuch library
---------------
+Provide a sane syntax for date ranges. First, we don't want to require
+both endpoints to be specified. For example it would be nice to be
+able to say things like "since:2009-01-1" or "until:2009-01-1" and
+have the other enpoint be implicit. Second we'de like to support
+relative specifications of time such as "since:'2 months ago'". To do
+any of this we're probably going to need to break down an write our
+own parser for the query string rather than using Xapian's QueryParser
+class.
+
Add support for files that are moved or deleted (which obviously need
to be handled differently).
diff --git a/lib/database-private.h b/lib/database-private.h
index 5f178f3..431966f 100644
--- a/lib/database-private.h
+++ b/lib/database-private.h
@@ -32,6 +32,7 @@ struct _notmuch_database {
Xapian::Database *xapian_db;
Xapian::QueryParser *query_parser;
Xapian::TermGenerator *term_gen;
+ Xapian::ValueRangeProcessor *value_range_processor;
};
#endif
diff --git a/lib/database.cc b/lib/database.cc
index 2c90019..3fe12dd 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -501,11 +501,13 @@ notmuch_database_open (const char *path,
notmuch->query_parser = new Xapian::QueryParser;
notmuch->term_gen = new Xapian::TermGenerator;
notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
+ notmuch->value_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
notmuch->query_parser->set_database (*notmuch->xapian_db);
notmuch->query_parser->set_stemmer (Xapian::Stem ("english"));
notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME);
+ notmuch->query_parser->add_valuerangeprocessor (notmuch->value_range_processor);
for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_EXTERNAL); i++) {
prefix_t *prefix = &BOOLEAN_PREFIX_EXTERNAL[i];
@@ -548,6 +550,7 @@ notmuch_database_close (notmuch_database_t *notmuch)
delete notmuch->term_gen;
delete notmuch->query_parser;
delete notmuch->xapian_db;
+ delete notmuch->value_range_processor;
talloc_free (notmuch);
}
diff --git a/notmuch.1 b/notmuch.1
index eeb1a94..c5a7711 100644
--- a/notmuch.1
+++ b/notmuch.1
@@ -408,6 +408,21 @@ Parentheses can also be used to control the combination of the Boolean
operators, but will have to be protected from interpretation by the
shell, (such as by putting quotation marks around any parenthesized
expression).
+
+Finally, results can be restricted to only messages within a
+particular time range, (based on the Date: header) with a syntax of:
+
+ <intial-timestamp>..<final-timestamp>
+
+Each timestamp is a number representing the number of seconds since
+1970-01-01 00:00:00 UTC. This is not the most convenient means of
+expressing date ranges, but until notmuch is fixed to accept a more
+convenient form, one can use the date program to construct
+timestamps. For example, with the bash shell the folowing syntax would
+specify a date range to return messages from 2009-10-01 until the
+current time:
+
+ $(date +%s -d 2009-10-01)..$(date +%s)
.SH SEE ALSO
The emacs-based interface to notmuch (available as
.B notmuch.el
diff --git a/notmuch.c b/notmuch.c
index 72ca620..24f8728 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -89,7 +89,22 @@ static const char search_terms_help[] =
"\t\tParentheses can also be used to control the combination of\n"
"\t\tthe Boolean operators, but will have to be protected from\n"
"\t\tinterpretation by the shell, (such as by putting quotation\n"
- "\t\tmarks around any parenthesized expression).\n\n";
+ "\t\tmarks around any parenthesized expression).\n"
+ "\n"
+ "\t\tFinally, results can be restricted to only messages within a\n"
+ "\t\tparticular time range, (based on the Date: header) with:\n"
+ "\n"
+ "\t\t\t<intial-timestamp>..<final-timestamp>\n"
+ "\n"
+ "\t\tEach timestamp is a number representing the number of seconds\n"
+ "\t\tsince 1970-01-01 00:00:00 UTC. This is not the most convenient\n"
+ "\t\tmeans of expressing date ranges, but until notmuch is fixed to\n"
+ "\t\taccept a more convenient form, one can use the date program to\n"
+ "\t\tconstruct timestamps. For example, with the bash shell the\n"
+ "\t\tfollowing syntax would specify a date range to return messages\n"
+ "\t\tfrom 2009-10-01 until the current time:\n"
+ "\n"
+ "\t\t\t$(date +%s -d 2009-10-01)..$(date +%s)\n\n";
command_t commands[] = {
{ "setup", notmuch_setup_command,