X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=database.cc;h=1666aff0a123d9d5c156ee20d8dc2c30d5b21602;hb=aa46a683a85af0d0234720bd93ae3d09bc360910;hp=c470cc34977c17beff7d152f78c5f1ac975cefd2;hpb=f281f4b677e56242c18628683dcd4533906f7551;p=notmuch diff --git a/database.cc b/database.cc index c470cc34..1666aff0 100644 --- a/database.cc +++ b/database.cc @@ -45,6 +45,7 @@ prefix_t BOOLEAN_PREFIX[] = { { "type", "K" }, { "tag", "L" }, { "msgid", "Q" }, + { "id", "Q" }, { "thread", "H" }, { "ref", "R" }, { "timestamp", "KTS" }, @@ -493,6 +494,9 @@ notmuch_database_open (const char *path) notmuch->query_parser = new Xapian::QueryParser; notmuch->query_parser->set_default_op (Xapian::Query::OP_AND); notmuch->query_parser->set_database (*notmuch->xapian_db); + notmuch->query_parser->add_boolean_prefix ("id", _find_prefix ("id")); + notmuch->query_parser->add_boolean_prefix ("tag", _find_prefix ("tag")); + notmuch->query_parser->add_boolean_prefix ("type", _find_prefix ("type")); } catch (const Xapian::Error &error) { fprintf (stderr, "A Xapian exception occurred: %s\n", error.get_msg().c_str()); @@ -542,11 +546,12 @@ find_timestamp_document (notmuch_database_t *notmuch, const char *db_key, static char * timestamp_db_key (const char *key) { - if (strlen (key) + 1 > NOTMUCH_TERM_MAX) { + int term_len = strlen (_find_prefix ("timestamp")) + strlen (key); + + if (term_len > NOTMUCH_TERM_MAX) return notmuch_sha1_of_string (key); - } else { + else return strdup (key); - } } notmuch_status_t