From: Art Cancro Date: Tue, 17 May 2005 19:33:07 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v7.86~4913 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=31d92bfe53a584b240d5ee034151a40fa73b6894;p=citadel.git *** empty log message *** --- diff --git a/citadel/serv_fulltext.c b/citadel/serv_fulltext.c index 37bfc3cd2..018ca9ab6 100644 --- a/citadel/serv_fulltext.c +++ b/citadel/serv_fulltext.c @@ -60,6 +60,8 @@ void ft_index_message(long msgnum, int op) { int num_tokens = 0; int *tokens = NULL; int i; + struct cdbdata *cdb_bucket; + int num_msgs; msg = CtdlFetchMessage(msgnum, 1); if (msg == NULL) return; @@ -71,10 +73,26 @@ void ft_index_message(long msgnum, int op) { if (num_tokens > 0) { for (i=0; ilen = 0; + cdb_bucket->ptr = malloc(sizeof(long)); } + num_msgs = cdb_bucket->len / sizeof(long); + + /* FIXME finish this */ + + cdb_free(cdb_bucket); + + /* FIXME unlock the file */ + } + free(tokens); } } @@ -128,8 +146,15 @@ int longcmp(const void *rec1, const void *rec2) { */ void do_fulltext_indexing(void) { int i; + static time_t last_index = 0L; - lprintf(CTDL_DEBUG, "do_fulltext_indexing() started\n"); + /* + * Make sure we don't run the indexer too frequently. + * FIXME move the setting into config + */ + if ( (time(NULL) - last_index) < 300L) { + return; + } /* * Check to see whether the fulltext index is up to date; if there @@ -140,19 +165,22 @@ void do_fulltext_indexing(void) { lprintf(CTDL_DEBUG, "CitControl.MMfulltext = %ld\n", CitControl.MMfulltext); if (CitControl.MMfulltext >= CitControl.MMhighest) { - lprintf(CTDL_DEBUG, "Nothing to do!\n"); + /* nothing to do! */ return; } - - /* - * Make sure we don't run the indexer too frequently. - * FIXME write this... - */ + lprintf(CTDL_DEBUG, "do_fulltext_indexing() started\n"); + /* * If we've switched wordbreaker modules, burn the index and start * over. FIXME write this... */ + if (CitControl.fulltext_wordbreaker != FT_WORDBREAKER_ID) { + lprintf(CTDL_INFO, "(re)initializing full text index\n"); + cdb_trunc(CDB_FULLTEXT); + CitControl.MMfulltext = 0L; + put_control(); + } /* * Now go through each room and find messages to index. diff --git a/citadel/serv_fulltext.o b/citadel/serv_fulltext.o index 7661e3c19..935d5092a 100644 Binary files a/citadel/serv_fulltext.o and b/citadel/serv_fulltext.o differ diff --git a/citadel/server.h b/citadel/server.h index 8281869e1..5484129ce 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -261,6 +261,7 @@ enum { CDB_DIRECTORY, /* address book directory */ CDB_USETABLE, /* network use table */ CDB_BIGMSGS, /* larger message bodies */ + CDB_FULLTEXT, /* full text search index */ MAXCDB /* total number of CDB's defined */ };