]> git.notmuchmail.org Git - notmuch/commitdiff
lib: Add non-content terms with a WDF value of 0.
authorCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2010 19:18:27 +0000 (11:18 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2010 19:18:27 +0000 (11:18 -0800)
The WDF is the "within-document frequency" value for a particular
term. It's intended to provide an indication of how frequent a term is
within a document, (for use in computing relevance). Xapian's term
generator already computes WDF values when we use that, (which we do
for indexing all mail content).

We don't use the term generator when adding single terms for things
that don't actually appear in the mail document, (such as tags, the
filename, etc.). In this case, the WDF value for these terms doesn't
matter much.

But Xapian's flint backend can be more efficient with changes to terms
that don't affect the document "length". So there's a performance
advantage for manipulating tags (with the flint backend) if the WDF of
these terms is 0.

lib/directory.cc
lib/message.cc

index 461c0cc367801b72819f429013a214552efc279d..bb6314ad7610b992726c8396251df1b64fa32606 100644 (file)
@@ -213,7 +213,7 @@ _notmuch_directory_create (notmuch_database_t *notmuch,
            Xapian::docid parent_id;
            char *term = talloc_asprintf (local, "%s%s",
                                          _find_prefix ("directory"), db_path);
-           directory->doc.add_term (term);
+           directory->doc.add_term (term, 0);
 
            directory->doc.set_data (path);
 
@@ -225,7 +225,7 @@ _notmuch_directory_create (notmuch_database_t *notmuch,
                term = talloc_asprintf (local, "%s%u:%s",
                                        _find_prefix ("directory-direntry"),
                                        parent_id, basename);
-               directory->doc.add_term (term);
+               directory->doc.add_term (term, 0);
            }
 
            directory->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
index 1cda55a1e1b67b9573f7994018cc97bb73d08acc..f0e905b70a339cc9c643710f313aa978c768e141 100644 (file)
@@ -192,7 +192,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
 
     db = static_cast<Xapian::WritableDatabase *> (notmuch->xapian_db);
     try {
-       doc.add_term (term);
+       doc.add_term (term, 0);
        talloc_free (term);
 
        doc.add_value (NOTMUCH_VALUE_MESSAGE_ID, message_id);
@@ -646,7 +646,7 @@ _notmuch_message_add_term (notmuch_message_t *message,
     if (strlen (term) > NOTMUCH_TERM_MAX)
        return NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG;
 
-    message->doc.add_term (term);
+    message->doc.add_term (term, 0);
 
     talloc_free (term);