aboutsummaryrefslogtreecommitdiffhomepage
path: root/database.cc
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-10-23 14:06:24 -0700
committerGravatar Carl Worth <cworth@cworth.org>2009-10-23 14:06:24 -0700
commit9fc4a365d6cf478563caa012862c58a9b3945f76 (patch)
treeac9309ede98660b05c3aece14acdc4ae31ace8e0 /database.cc
parent6b228e45099f0e472326bf2dbbefb7b55e154359 (diff)
database: Rename internal find_messages_by_term to find_doc_ids
This name is a more accurate description of what it does, and the more general naming will make sense as we start storing non-message documents in the database (such as directory timestamps). Also, don't pass around a Xapian::Database where it's more our style to pass a notmuch_database_t*.
Diffstat (limited to 'database.cc')
-rw-r--r--database.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/database.cc b/database.cc
index e315f8dc..15d159ff 100644
--- a/database.cc
+++ b/database.cc
@@ -74,21 +74,20 @@ add_term (Xapian::Document doc,
}
static void
-find_messages_by_term (Xapian::Database *db,
- const char *prefix_name,
- const char *value,
- Xapian::PostingIterator *begin,
- Xapian::PostingIterator *end)
+find_doc_ids (notmuch_database_t *notmuch,
+ const char *prefix_name,
+ const char *value,
+ Xapian::PostingIterator *begin,
+ Xapian::PostingIterator *end)
{
Xapian::PostingIterator i;
char *term;
term = g_strdup_printf ("%s%s", _find_prefix (prefix_name), value);
- *begin = db->postlist_begin (term);
+ *begin = notmuch->xapian_db->postlist_begin (term);
- if (end)
- *end = db->postlist_end (term);
+ *end = notmuch->xapian_db->postlist_end (term);
free (term);
}
@@ -128,8 +127,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch,
{
Xapian::PostingIterator i, end;
- find_messages_by_term (notmuch->xapian_db,
- "msgid", message_id, &i, &end);
+ find_doc_ids (notmuch, "msgid", message_id, &i, &end);
if (i == end)
return NULL;
@@ -161,7 +159,7 @@ find_thread_ids (notmuch_database_t *notmuch,
thread_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
free, NULL);
- find_messages_by_term (db, "ref", message_id, &child, &children_end);
+ find_doc_ids (notmuch, "ref", message_id, &child, &children_end);
for ( ; child != children_end; child++) {
doc = find_message_by_docid (db, *child);
insert_thread_id (thread_ids, doc);