* Full text indexer is now switchable on/off
authorArt Cancro <ajc@citadel.org>
Sun, 22 May 2005 16:12:26 +0000 (16:12 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 22 May 2005 16:12:26 +0000 (16:12 +0000)
12 files changed:
citadel/ChangeLog
citadel/citadel.h
citadel/config.h
citadel/control.c
citadel/imap_misc.c
citadel/imap_search.c
citadel/msgbase.c
citadel/room_ops.c
citadel/routines2.c
citadel/serv_fulltext.c
citadel/serv_imap.c
citadel/serv_upgrade.c

index 889c025dfc2180e4c01faff0887eda95fdc62b4e..862c44e9d4ba38d9e1d158362a1ae5c512a5f336 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 647.18  2005/05/22 16:12:25  ajc
+ * Full text indexer is now switchable on/off
+
  Revision 647.17  2005/05/20 20:02:50  ajc
  * The IGnet map is now rewritten to disk only when it changes.
  * When processing inbound network spool, ignore "." and ".." instead of
@@ -6753,3 +6756,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 62a1a5e6c15eb8216088a4eec40e519a44ae3874..24b5987ee36dcab0fbb3678cce904fe025d412e4 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 /*
  * Text description of this software
  */
-#define CITADEL        "Citadel 6.47"
+#define CITADEL        "Citadel 6.51"
 
 /*
  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
@@ -45,7 +45,7 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      647             /* This version */
+#define REV_LEVEL      651             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
 #define EXPORT_REV_MIN 626             /* Oldest compatible export files */
 
@@ -79,69 +79,6 @@ struct ExpirePolicy {
 #define EXPIRE_AGE             3       /* Expire messages after n days */
 
 
-/* 
- * Global system configuration.
- * 
- * Developers: please do NOT remove the fields labelled "not in use".  We
- * can't simply remove them from the struct, because this gets written to
- * disk, and if you change it then you'll break all existing systems.
- * However, if you'd like to reclaim some of that space for another use, feel
- * free to do so, as long as the sizes are kept identical.
- */
-struct config {
-       char c_nodename[16];            /* Unqualified "short" nodename     */
-       char c_fqdn[64];                /* Fully Qualified Domain Name      */
-       char c_humannode[21];           /* Long name of system              */
-       char c_phonenum[16];            /* Dialup number of system          */
-       uid_t c_ctdluid;                /* UID under which we run Citadel   */
-       char c_creataide;               /* room creator = room aide  flag   */
-       int c_sleeping;                 /* watchdog timer setting           */
-       char c_initax;                  /* initial access level             */
-       char c_regiscall;               /* call number to register on       */
-       char c_twitdetect;              /* twit detect flag                 */
-       char c_twitroom[ROOMNAMELEN];   /* twit detect msg move to room     */
-       char c_moreprompt[80];          /* paginator prompt                 */
-       char c_restrict;                /* restrict Internet mail flag      */
-       long c_niu_1;                   /* (not in use)                     */
-       char c_site_location[32];               /* physical location of server      */
-       char c_sysadm[26];              /* name of system administrator     */
-       char c_niu_2[15];               /* (not in use)                     */
-       int c_setup_level;              /* what rev level we've setup to    */
-       int c_maxsessions;              /* maximum concurrent sessions      */
-       char c_ip_addr[20];             /* IP address to listen on          */
-       int c_port_number;              /* Cit listener port (usually 504)  */
-       int c_ipgm_secret;              /* Internal program authentication  */
-       struct ExpirePolicy c_ep;       /* System default msg expire policy */
-       int c_userpurge;                /* System default user purge (days) */
-       int c_roompurge;                /* System default room purge (days) */
-       char c_logpages[ROOMNAMELEN];   /* Room to log pages to (or not)    */
-       char c_createax;                /* Axlevel required to create rooms */
-       long c_maxmsglen;               /* Maximum message length           */
-       int c_min_workers;              /* Lower limit on number of threads */
-       int c_max_workers;              /* Upper limit on number of threads */
-       int c_pop3_port;                /* POP3 listener port (usually 110) */
-       int c_smtp_port;                /* SMTP listener port (usually 25)  */
-       int c_rfc822_strict_from;       /* 1 = don't correct From: forgeries*/
-       int c_aide_zap;                 /* Are Aides allowed to zap rooms?  */
-       int c_imap_port;                /* IMAP listener port (usually 143) */
-       time_t c_net_freq;              /* how often to run the networker   */
-       char c_disable_newu;            /* disable NEWU command             */
-       char c_niu_4;                   /* (not in use)                     */
-       char c_baseroom[ROOMNAMELEN];   /* Name of baseroom (Lobby)         */
-       char c_aideroom[ROOMNAMELEN];   /* Name of aideroom (Aide)          */
-       int c_purge_hour;               /* Hour during which db purges run  */
-       struct ExpirePolicy c_mbxep;    /* Expire policy for mailbox rooms  */
-       char c_ldap_host[128];          /* Host where LDAP service lives    */
-       int c_ldap_port;                /* Port on host where LDAP lives    */
-       char c_ldap_base_dn[256];       /* LDAP base DN                     */
-       char c_ldap_bind_dn[256];       /* LDAP bind DN                     */
-       char c_ldap_bind_pw[256];       /* LDAP bind password               */
-       int c_msa_port;                 /* SMTP MSA listener port (usu 587) */
-       int c_imaps_port;               /* IMAPS listener port (usually 993)*/
-       int c_pop3s_port;               /* POP3S listener port (usually 995)*/
-       int c_smtps_port;               /* SMTPS listener port (usually 465)*/
-};
-
 /*
  * This struct stores a list of rooms with new messages which the client
  * fetches from the server.  This allows the client to "march" through
index 7b19059461b0c43115e32494323179816a608df8..160c5d96e8bac005a53e11de190c058d91f59254 100644 (file)
@@ -5,6 +5,70 @@
 
 #include "serv_extensions.h"
 
+/* 
+ * Global system configuration.
+ * 
+ * Developers: please do NOT remove the fields labelled "not in use".  We
+ * can't simply remove them from the struct, because this gets written to
+ * disk, and if you change it then you'll break all existing systems.
+ * However, if you'd like to reclaim some of that space for another use, feel
+ * free to do so, as long as the sizes are kept identical.
+ */
+struct config {
+       char c_nodename[16];            /* Unqualified "short" nodename     */
+       char c_fqdn[64];                /* Fully Qualified Domain Name      */
+       char c_humannode[21];           /* Long name of system              */
+       char c_phonenum[16];            /* Dialup number of system          */
+       uid_t c_ctdluid;                /* UID under which we run Citadel   */
+       char c_creataide;               /* room creator = room aide  flag   */
+       int c_sleeping;                 /* watchdog timer setting           */
+       char c_initax;                  /* initial access level             */
+       char c_regiscall;               /* call number to register on       */
+       char c_twitdetect;              /* twit detect flag                 */
+       char c_twitroom[ROOMNAMELEN];   /* twit detect msg move to room     */
+       char c_moreprompt[80];          /* paginator prompt                 */
+       char c_restrict;                /* restrict Internet mail flag      */
+       long c_niu_1;                   /* (not in use)                     */
+       char c_site_location[32];       /* physical location of server      */
+       char c_sysadm[26];              /* name of system administrator     */
+       char c_niu_2[15];               /* (not in use)                     */
+       int c_setup_level;              /* what rev level we've setup to    */
+       int c_maxsessions;              /* maximum concurrent sessions      */
+       char c_ip_addr[20];             /* IP address to listen on          */
+       int c_port_number;              /* Cit listener port (usually 504)  */
+       int c_ipgm_secret;              /* Internal program authentication  */
+       struct ExpirePolicy c_ep;       /* System default msg expire policy */
+       int c_userpurge;                /* System default user purge (days) */
+       int c_roompurge;                /* System default room purge (days) */
+       char c_logpages[ROOMNAMELEN];   /* Room to log pages to (or not)    */
+       char c_createax;                /* Axlevel required to create rooms */
+       long c_maxmsglen;               /* Maximum message length           */
+       int c_min_workers;              /* Lower limit on number of threads */
+       int c_max_workers;              /* Upper limit on number of threads */
+       int c_pop3_port;                /* POP3 listener port (usually 110) */
+       int c_smtp_port;                /* SMTP listener port (usually 25)  */
+       int c_rfc822_strict_from;       /* 1 = don't correct From: forgeries*/
+       int c_aide_zap;                 /* Are Aides allowed to zap rooms?  */
+       int c_imap_port;                /* IMAP listener port (usually 143) */
+       time_t c_net_freq;              /* how often to run the networker   */
+       char c_disable_newu;            /* disable NEWU command             */
+       char c_enable_fulltext;         /* enable full text indexing        */
+       char c_baseroom[ROOMNAMELEN];   /* Name of baseroom (Lobby)         */
+       char c_aideroom[ROOMNAMELEN];   /* Name of aideroom (Aide)          */
+       int c_purge_hour;               /* Hour during which db purges run  */
+       struct ExpirePolicy c_mbxep;    /* Expire policy for mailbox rooms  */
+       char c_ldap_host[128];          /* Host where LDAP service lives    */
+       int c_ldap_port;                /* Port on host where LDAP lives    */
+       char c_ldap_base_dn[256];       /* LDAP base DN                     */
+       char c_ldap_bind_dn[256];       /* LDAP bind DN                     */
+       char c_ldap_bind_pw[256];       /* LDAP bind password               */
+       int c_msa_port;                 /* SMTP MSA listener port (usu 587) */
+       int c_imaps_port;               /* IMAPS listener port (usually 993)*/
+       int c_pop3s_port;               /* POP3S listener port (usually 995)*/
+       int c_smtps_port;               /* SMTPS listener port (usually 465)*/
+};
+
+
 void get_config(void);
 void put_config(void);
 extern struct config config;
index d018f2743b41cb7c4efb4e8c5c92a98c083d92ad..e497f3dbc650c39b2fb192e3dc9ad3a1b177230c 100644 (file)
@@ -194,7 +194,7 @@ void cmd_conf(char *argbuf)
                cprintf("%d\n", config.c_imap_port);
                cprintf("%ld\n", config.c_net_freq);
                cprintf("%d\n", config.c_disable_newu);
-               cprintf("1\n"); /* no longer in use */
+               cprintf("%d\n", config.c_enable_fulltext);
                cprintf("%d\n", config.c_purge_hour);
 #ifdef HAVE_LDAP
                cprintf("%s\n", config.c_ldap_host);
@@ -344,7 +344,7 @@ void cmd_conf(char *argbuf)
                                        config.c_disable_newu = 1;
                                break;
                        case 30:
-                               /* no longer in use */
+                               config.c_enable_fulltext = atoi(buf);
                                break;
                        case 31:
                                if ((config.c_purge_hour >= 0)
index 0ddd8d401ea553310776285422f834fdc8843f19..59e5d8178381698563efe3cb39c15a9af98e2bfe 100644 (file)
@@ -331,7 +331,7 @@ void imap_append(int num_parms, char *parms[]) {
 
        ret = imap_grabroom(roomname, parms[2], 0);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or location, or access denied\r\n",
+               cprintf("%s NO Invalid mailbox name or access denied\r\n",
                        parms[0]);
                return;
        }
index c43e966fbf8a396606bf87dc74c49b00c9ef1fd2..a179a759e283e4e92fbed70b4446f95502224734 100644 (file)
@@ -449,9 +449,9 @@ void imap_do_search(int num_items, char **itemlist, int is_uid) {
 
        /* If there is a BODY search criterion in the query, use our full
         * text index to disqualify messages that don't have any chance of
-        * matching.
+        * matching.  (Only do this if the index is enabled!!)
         */
-       for (i=0; i<(num_items-1); ++i) {
+        if (config.c_enable_fulltext) for (i=0; i<(num_items-1); ++i) {
                if (!strcasecmp(itemlist[i], "BODY")) {
                        ft_search(&fts_num_msgs, &fts_msgs, itemlist[i+1]);
                        if (fts_num_msgs > 0) {
index 0ee40f6ee84b6fc919ff08d75a693fd37f9d396e..cf73c74f956d3facef92bc534d6a36e6411676fe 100644 (file)
@@ -44,6 +44,7 @@
 #include "room_ops.h"
 #include "user_ops.h"
 #include "file_ops.h"
+#include "config.h"
 #include "control.h"
 #include "tools.h"
 #include "mime_parser.h"
@@ -52,7 +53,6 @@
 #include "internet_addressing.h"
 #include "serv_fulltext.h"
 
-extern struct config config;
 long config_msgnum;
 
 
@@ -343,10 +343,16 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set) {
        memset(is_set, 0, (num_msgs * sizeof(char)) );
 
        /* Decide which message set we're manipulating */
-       if (which_set == ctdlsetseen_seen) safestrncpy(vset, vbuf.v_seen, sizeof vset);
-       if (which_set == ctdlsetseen_answered) safestrncpy(vset, vbuf.v_answered, sizeof vset);
+       switch(which_set) {
+               case ctdlsetseen_seen:
+                       safestrncpy(vset, vbuf.v_seen, sizeof vset);
+                       break;
+               case ctdlsetseen_answered:
+                       safestrncpy(vset, vbuf.v_answered, sizeof vset);
+                       break;
+       }
 
-       lprintf(CTDL_DEBUG, "before optimize: %s\n", vset);
+       /* lprintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
 
        /* Translate the existing sequence set into an array of booleans */
        num_sets = num_tokens(vset, ',');
@@ -420,11 +426,18 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set) {
        }
 
        /* Decide which message set we're manipulating */
-       if (which_set == ctdlsetseen_seen) safestrncpy(vbuf.v_seen, vset, sizeof vbuf.v_seen);
-       if (which_set == ctdlsetseen_answered) safestrncpy(vbuf.v_answered, vset, sizeof vbuf.v_answered);
+       switch (which_set) {
+               case ctdlsetseen_seen:
+                       safestrncpy(vbuf.v_seen, vset, sizeof vbuf.v_seen);
+                       break;
+               case ctdlsetseen_answered:
+                       safestrncpy(vbuf.v_answered, vset,
+                                               sizeof vbuf.v_answered);
+                       break;
+       }
        free(is_set);
 
-       lprintf(CTDL_DEBUG, " after optimize: %s\n", vset);
+       /* lprintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
        free(msglist);
        CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
 }
@@ -2147,7 +2160,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        }
 
        /* Bump this user's messages posted counter. */
-       lprintf(CTDL_DEBUG, "Updating user\n");
+       lprintf(CTDL_DEBUG, "Updating user (FIXME defer this)\n");
        lgetuser(&CC->user, CC->curr_user);
        CC->user.posted = CC->user.posted + 1;
        lputuser(&CC->user);
@@ -3167,13 +3180,11 @@ void AdjRefCount(long msgnum, int incr)
         */
        begin_critical_section(S_SUPPMSGMAIN);
        GetMetaData(&smi, msgnum);
-       lprintf(CTDL_DEBUG, "Ref count for message <%ld> before write is <%d>\n",
-               msgnum, smi.meta_refcount);
        smi.meta_refcount += incr;
        PutMetaData(&smi);
        end_critical_section(S_SUPPMSGMAIN);
-       lprintf(CTDL_DEBUG, "Ref count for message <%ld> after write is <%d>\n",
-               msgnum, smi.meta_refcount);
+       lprintf(CTDL_DEBUG, "msg %ld ref count incr %d, is now %d\n",
+               msgnum, incr, smi.meta_refcount);
 
        /* If the reference count is now zero, delete the message
         * (and its supplementary record as well).
index cb73a80cd53251e883910e8554ce09803fe56a19..4cc226dc3af00f3532d6f62eff4a8a9ea808894d 100644 (file)
@@ -830,7 +830,6 @@ void usergoto(char *where, int display_result, int transiently,
                cdb_free(cdbfr);
        }
 
-       lprintf(CTDL_DEBUG, " *** START COUNT *** \n");
        total_messages = 0;
        for (a=0; a<num_msgs; ++a) {
                if (msglist[a] > 0L) ++total_messages;
@@ -860,7 +859,6 @@ void usergoto(char *where, int display_result, int transiently,
                        }
                }
        }
-       lprintf(CTDL_DEBUG, " ***  END  COUNT *** \n");
        new_messages = total_messages - old_messages;
 
        if (msglist != NULL) free(msglist);
index 1f62c18889aef39d06ab4956b9f5c08c82e24a94..8491481314831820c1c1b0db4ea7460456c8b89a 100644 (file)
@@ -829,6 +829,9 @@ void do_system_configuration(CtdlIPC *ipc)
 
        strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
        strprompt("Hour to run purges (0-23)", &sc[31][0], 2);
+       snprintf(sc[30], sizeof sc[30], "%d", (boolprompt(
+               "Enable full text search index (warning: resource intensive)",
+               atoi(&sc[30][0]))));
 
        /* Save it */
        scr_printf("Save this configuration? ");
index d88f50f5e6ac28941af600b6555555176825a956..59e8d01d425d60c1bd619f3babaa0c47ee66b785 100644 (file)
@@ -208,6 +208,13 @@ void do_fulltext_indexing(void) {
        static time_t last_index = 0L;
        static time_t last_progress = 0L;
 
+       /*
+        * Don't do this if the site doesn't have it enabled.
+        */
+       if (!config.c_enable_fulltext) {
+               return;
+       }
+
        /*
         * Make sure we don't run the indexer too frequently.
         * FIXME move the setting into config
@@ -365,6 +372,12 @@ void cmd_srch(char *argbuf) {
        char search_string[256];
 
        if (CtdlAccessCheck(ac_logged_in)) return;
+
+       if (!config.c_enable_fulltext) {
+               cprintf("%d Full text index is not enabled on this server.\n",
+                       ERROR + CMD_NOT_SUPPORTED);
+       }
+
        extract_token(search_string, argbuf, 0, '|', sizeof search_string);
        ft_search(&num_msgs, &msgs, search_string);
 
index d40ca8745cac46f6c74d71ddb058a89a8ac6bdce..c4bd19dd7ece64eb22227b4cfb3036968403dc20 100644 (file)
@@ -251,7 +251,10 @@ void imap_rescan_msgids(void)
                return;
        }
 
-       /* Check to see if the room's contents have changed.  If not, we can avoid rescan */
+       /*
+        * Check to see if the room's contents have changed.
+        * If not, we can avoid this rescan.
+        */
        getroom(&CC->room, CC->room.QRname);
        if (IMAP->last_mtime == CC->room.QRmtime) {     /* No changes! */
                return;
@@ -291,9 +294,10 @@ void imap_rescan_msgids(void)
                        if (message_still_exists == 0) {
                                cprintf("* %d EXPUNGE\r\n", i + 1);
 
-                               /* Here's some nice stupid nonsense.  When a message
-                                * is expunged, we have to slide all the existing
-                                * messages up in the message array.
+                               /* Here's some nice stupid nonsense.  When a
+                                * message is expunged, we have to slide all
+                                * the existing messages up in the message
+                                * array.
                                 */
                                --IMAP->num_msgs;
                                memcpy(&IMAP->msgids[i],
@@ -323,12 +327,13 @@ void imap_rescan_msgids(void)
        /*
         * Now peruse the room for *new* messages only.
         */
-       if (num_msgs > 0)
+       if (num_msgs > 0) {
                for (j = 0; j < num_msgs; ++j) {
                        if (msglist[j] > original_highest) {
                                imap_add_single_msgid(msglist[j], NULL);
                        }
                }
+       }
        imap_set_seen_flags();
 
        /*
index 8abbad180bbffc8e5d6437da80b3de9b4b181041..000e8afeabaf397f840005131283f4d0740973d1 100644 (file)
@@ -172,6 +172,10 @@ void update_config(void) {
                strcpy(config.c_ip_addr, "0.0.0.0");
        }
 
+       if (CitControl.version < 650) {
+               config.c_enable_fulltext = 0;
+       }
+
        put_config();
 }