store: add 'add_document' optimization, use it

*Usually* we need Xapian's replace_document() API, but when we know a
document (message) is completely new, we can use the faster
add_document(). That is the case with the initial (re)indexing, when
start with an empty database.

Also a few smaller cleanups.
This commit is contained in:
Dirk-Jan C. Binnema
2023-07-25 23:52:22 +03:00
parent 4d8ba5f579
commit 4c0b7db3d8
5 changed files with 89 additions and 67 deletions

View File

@ -202,7 +202,7 @@ goto * instructions[pOp->opcode];
g_assert_cmpuint(store->size(),==, 1);
/* ensure 'update' dtrt, i.e., nothing. */
const auto docid2 = store->update_message(*message, *docid);
const auto docid2 = store->add_message(*message, *docid);
assert_valid_result(docid2);
g_assert_cmpuint(store->size(),==, 1);
g_assert_cmpuint(*docid,==,*docid2);