0cbcd2e24bf838a717a5dd4358839f17aba7e6ae
[citadel.git] / citadel / serv_fulltext.c
1 /*
2  * $Id$
3  *
4  * This module handles fulltext indexing of the message base.
5  *
6  */
7
8
9 #include "sysdep.h"
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <stdio.h>
13 #include <fcntl.h>
14 #include <signal.h>
15 #include <pwd.h>
16 #include <errno.h>
17 #include <sys/types.h>
18
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
21 # include <time.h>
22 #else
23 # if HAVE_SYS_TIME_H
24 #  include <sys/time.h>
25 # else
26 #  include <time.h>
27 # endif
28 #endif
29
30 #include <sys/wait.h>
31 #include <string.h>
32 #include <limits.h>
33 #include "citadel.h"
34 #include "server.h"
35 #include "sysdep_decls.h"
36 #include "citserver.h"
37 #include "support.h"
38 #include "config.h"
39 #include "serv_extensions.h"
40 #include "database.h"
41 #include "msgbase.h"
42 #include "control.h"
43 #include "tools.h"
44 #include "serv_fulltext.h"
45 #include "ft_wordbreaker.h"
46
47
48 void do_fulltext_indexing(void) {
49         lprintf(CTDL_DEBUG, "do_fulltext_indexing() started\n");
50
51         /*
52          * Check to see whether the fulltext index is up to date; if there
53          * are no messages to index, don't waste any more time trying.
54          */
55         lprintf(CTDL_DEBUG, "CitControl.MMhighest  = %ld\n", CitControl.MMhighest);
56         lprintf(CTDL_DEBUG, "CitControl.MMfulltext = %ld\n", CitControl.MMfulltext);
57         if (CitControl.MMfulltext >= CitControl.MMhighest) {
58                 lprintf(CTDL_DEBUG, "Nothing to do!\n");
59                 return;
60         }
61
62         /*
63          * If we've switched wordbreaker modules, burn the index and start
64          * over.  FIXME write this...
65          */
66
67
68         lprintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");
69         return;
70 }
71
72
73 /*****************************************************************************/
74
75 char *serv_fulltext_init(void)
76 {
77         CtdlRegisterSessionHook(do_fulltext_indexing, EVT_TIMER);
78         return "$Id$";
79 }