From: Art Cancro Date: Wed, 30 Aug 2023 16:03:08 +0000 (-0400) Subject: Rewrote the indexer X-Git-Tag: v989~11 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=8cee15b64ecd57c52334feffbe1433ae7973ebbb;p=citadel.git Rewrote the indexer --- diff --git a/citadel/server/modules/fulltext/serv_fulltext.c b/citadel/server/modules/fulltext/serv_fulltext.c index 216097174..994e856bb 100644 --- a/citadel/server/modules/fulltext/serv_fulltext.c +++ b/citadel/server/modules/fulltext/serv_fulltext.c @@ -34,6 +34,13 @@ #include "../../context.h" #include "../../ctdl_module.h" + +// These can be global variables because only one indexer runs at a time. +Array *messages_to_be_indexed = NULL; +long highest_msg_already_indexed = 0; +long highest_msg_to_be_indexed = 0; + + // Compare function int longcmp(const void *rec1, const void *rec2) { long i1, i2; @@ -47,11 +54,6 @@ int longcmp(const void *rec1, const void *rec2) { } - //if (ftc_msgs[i] != NULL) { - //cdb_store(CDB_FULLTEXT, &i, sizeof(int), ftc_msgs[i], (ftc_num_msgs[i] * sizeof(long))); - - - // Index or de-index a message. (op == 1 to index, 0 to de-index) void ft_index_message(long msgnum, int op) { int i, j; @@ -66,6 +68,8 @@ void ft_index_message(long msgnum, int op) { msg = CtdlFetchMessage(msgnum, 1); if (msg == NULL) { + // This is not necessarily an error condition; it could simply mean that the message was + // deleted before it could be indexed. This happens often when the load tester is running. syslog(LOG_ERR, "fulltext: ft_index_message() could not load msg %ld", msgnum); return; } @@ -98,29 +102,47 @@ void ft_index_message(long msgnum, int op) { ); if (array_len(tokens_in_this_message) > 0) { + cdb_begin_transaction(); for (i=0; iQRnumber, &msglist); + + // Identify messages which have NOT yet been seen by the indexer. if (msglist != NULL) { for (i=0; i