aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/index.cc24
-rw-r--r--lib/message.cc9
2 files changed, 17 insertions, 16 deletions
diff --git a/lib/index.cc b/lib/index.cc
index e1e2a382..1a2e63df 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -231,26 +231,22 @@ _index_address_mailbox (notmuch_message_t *message,
InternetAddress *address)
{
InternetAddressMailbox *mailbox = INTERNET_ADDRESS_MAILBOX (address);
- const char *name, *addr;
+ const char *name, *addr, *combined;
void *local = talloc_new (message);
name = internet_address_get_name (address);
addr = internet_address_mailbox_get_addr (mailbox);
- /* In the absence of a name, we'll strip the part before the @
- * from the address. */
- if (! name) {
- const char *at;
+ /* Combine the name and address and index them as a phrase. */
+ if (name && addr)
+ combined = talloc_asprintf (local, "%s %s", name, addr);
+ else if (name)
+ combined = name;
+ else
+ combined = addr;
- at = strchr (addr, '@');
- if (at)
- name = talloc_strndup (local, addr, at - addr);
- }
-
- if (name)
- _notmuch_message_gen_terms (message, prefix_name, name);
- if (addr)
- _notmuch_message_gen_terms (message, prefix_name, addr);
+ if (combined)
+ _notmuch_message_gen_terms (message, prefix_name, combined);
talloc_free (local);
}
diff --git a/lib/message.cc b/lib/message.cc
index 9243b769..d0b7351e 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1023,16 +1023,21 @@ _notmuch_message_gen_terms (notmuch_message_t *message,
return NOTMUCH_PRIVATE_STATUS_NULL_POINTER;
term_gen->set_document (message->doc);
- term_gen->set_termpos (message->termpos);
if (prefix_name) {
const char *prefix = _find_prefix (prefix_name);
+ term_gen->set_termpos (message->termpos);
term_gen->index_text (text, 1, prefix);
- message->termpos = term_gen->get_termpos ();
+ /* Create a gap between this an the next terms so they don't
+ * appear to be a phrase. */
+ message->termpos = term_gen->get_termpos () + 100;
}
+ term_gen->set_termpos (message->termpos);
term_gen->index_text (text);
+ /* Create a term gap, as above. */
+ message->termpos = term_gen->get_termpos () + 100;
return NOTMUCH_PRIVATE_STATUS_SUCCESS;
}