Fixed a logic bug that caused the full text index
authorArt Cancro <ajc@citadel.org>
Tue, 18 Jul 2006 02:39:51 +0000 (02:39 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 18 Jul 2006 02:39:51 +0000 (02:39 +0000)
to get rebuilt from scratch every time the global system configuration
was edited.

citadel/control.c
citadel/serv_fulltext.c

index 2260fa5617e716aec948d95edee1c1b509566206..5a7f2e97a9e7920b40561f3f0e5576d8ba312ad9 100644 (file)
@@ -431,7 +431,7 @@ void cmd_conf(char *argbuf)
                /* If full text indexing has been disabled, invalidate the
                 * index so it doesn't try to use it later.
                 */
-               if (!config.c_enable_fulltext == 0) {
+               if (config.c_enable_fulltext == 0) {
                        CitControl.fulltext_wordbreaker = 0;
                        put_control();
                }
index 2c23d49dc09b30387fe1e7785d2f9a6dd0396778..9c6f1d896167b69c5bd07f8da82bad2b808fcafd 100644 (file)
@@ -249,12 +249,16 @@ void do_fulltext_indexing(void) {
         * If we've switched wordbreaker modules, burn the index and start
         * over.
         */
+       begin_critical_section(S_CONTROL);
+       lprintf(CTDL_DEBUG, "wb ver on disk = %d, code ver = %d\n",
+                       CitControl.fulltext_wordbreaker, FT_WORDBREAKER_ID);
        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();
        }
+       end_critical_section(S_CONTROL);
 
        /*
         * Now go through each room and find messages to index.
@@ -309,9 +313,11 @@ void do_fulltext_indexing(void) {
 
        /* Save our place so we don't have to do this again */
        ft_flush_cache();
+       begin_critical_section(S_CONTROL);
        CitControl.MMfulltext = ft_newhighest;
        CitControl.fulltext_wordbreaker = FT_WORDBREAKER_ID;
        put_control();
+       end_critical_section(S_CONTROL);
        last_index = time(NULL);
 
        lprintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");