X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=82e8fce7edca3953a6503b5d2f5e7e76208c5200;hb=28ce73848d98d8ee2b661733402e2c10b13418d5;hp=7d586903913305b9e654644024b016bbcc1f6f28;hpb=1376a90db622b71e0997fca52c50ccf34faeed22;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index 7d586903..82e8fce7 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -393,11 +393,9 @@ notmuch_status_t _notmuch_message_add_filename (notmuch_message_t *message, const char *filename) { - const char *relative, *directory, *basename; - char *term; - Xapian::docid directory_id; notmuch_status_t status; void *local = talloc_new (message); + char *direntry; if (message->filename) { talloc_free (message->filename); @@ -407,22 +405,13 @@ _notmuch_message_add_filename (notmuch_message_t *message, if (filename == NULL) INTERNAL_ERROR ("Message filename cannot be NULL."); - relative = _notmuch_database_relative_path (message->notmuch, filename); - - status = _notmuch_database_split_path (local, relative, - &directory, &basename); + status = _notmuch_database_filename_to_direntry (local, + message->notmuch, + filename, &direntry); if (status) return status; - status = _notmuch_database_find_directory_id (message->notmuch, directory, - &directory_id); - if (status) - return status; - - term = talloc_asprintf (local, "%s%u:%s", - _find_prefix ("direntry"), directory_id, basename); - - message->doc.add_term (term); + _notmuch_message_add_term (message, "file-direntry", direntry); talloc_free (local); @@ -432,7 +421,7 @@ _notmuch_message_add_filename (notmuch_message_t *message, const char * notmuch_message_get_filename (notmuch_message_t *message) { - const char *prefix = _find_prefix ("direntry"); + const char *prefix = _find_prefix ("file-direntry"); int prefix_len = strlen (prefix); Xapian::TermIterator i; char *direntry, *colon;