#include "html.h"
#include "genstamp.h"
#include "internet_addressing.h"
+#include "serv_fulltext.h"
extern struct config config;
long config_msgnum;
/* If the reference count is now zero, delete the message
* (and its supplementary record as well).
+ * FIXME ... defer this so it doesn't keep the user waiting.
*/
if (smi.meta_refcount == 0) {
lprintf(CTDL_DEBUG, "Deleting message <%ld>\n", msgnum);
+ /* ft_index_message(msgnum, 0); remove from fulltext index */
delnum = msgnum;
cdb_delete(CDB_MSGMAIN, &delnum, (int)sizeof(long));
cdb_delete(CDB_BIGMSGS, &delnum, (int)sizeof(long));
int num_msgs;
long *msgs;
+ lprintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n",
+ (op ? "adding" : "removing") , msgnum
+ );
+
msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
/* Add the message to the relevant token bucket */
- /* FIXME do "if op=1" ... */
-
/* FIXME lock the file */
cdb_bucket = cdb_fetch(CDB_FULLTEXT, &tokens[i], sizeof(int));
if (cdb_bucket == NULL) {
num_msgs = cdb_bucket->len / sizeof(long);
}
- ++num_msgs;
- cdb_bucket->ptr = realloc(cdb_bucket->ptr, num_msgs*sizeof(long) );
- msgs = (long *) cdb_bucket->ptr;
- msgs[num_msgs - 1] = msgnum;
+ if (op == 1) { /* add to index */
+ ++num_msgs;
+ cdb_bucket->ptr = realloc(cdb_bucket->ptr, num_msgs*sizeof(long) );
+ msgs = (long *) cdb_bucket->ptr;
+ msgs[num_msgs - 1] = msgnum;
+ }
- /* lprintf(CTDL_DEBUG, "bucket <%5d> position <%2d> msg <%ld>\n",
- tokens[i], num_msgs-1, msgnum); */
+ if (op == 0) { /* remove from index */
+ /* FIXME do this */
+ }
/* sort and purge dups */
if (num_msgs > 1) {