diff options
author | Carl Worth <cworth@cworth.org> | 2011-01-26 15:53:14 +1000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2011-01-26 15:59:19 +1000 |
commit | db70f3f0c4132b6113a68604dc8439360dc9b9b8 (patch) | |
tree | 221465f61bc52965a57765f9ee4da67a0aa588b0 | |
parent | fb54dee4ac1265b1cdf5b039e7c86a419decd04c (diff) |
lib: Save and restore term position in message while indexing.
This fixes the recently addead search-position-overlap bug as
demonstrated in the test of the same name.
-rw-r--r-- | lib/message.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/message.cc b/lib/message.cc index 0d9542e6..0590f764 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -39,6 +39,7 @@ struct _notmuch_message { unsigned long flags; Xapian::Document doc; + Xapian::termcount termpos; }; #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0])) @@ -123,6 +124,7 @@ _notmuch_message_create_for_document (const void *talloc_owner, talloc_set_destructor (message, _notmuch_message_destructor); message->doc = doc; + message->termpos = 0; return message; } @@ -824,11 +826,13 @@ _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->index_text (text, 1, prefix); + message->termpos = term_gen->get_termpos (); } term_gen->index_text (text); |