export fulltext records
authorArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:25:57 +0000 (06:25 -0900)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:25:57 +0000 (06:25 -0900)
citadel/utils/ctdldump.c

index 4ad01e3de442fc450596818cca0919a0b2b0fc1a..1360da059ca941358c4374df18cfcabc39fb4c3f 100644 (file)
@@ -216,8 +216,8 @@ void export_floor(int which_cdb, DBT *in_key, DBT *in_data) {
 }
 
 
-// export function for a msglist or a fulltext index record
-// (both are indexed by a long and the data is arrays of longs)
+// export function for a msglist
+// (indexed by a long and the data is arrays of longs)
 void export_msglist(int which_cdb, DBT *in_key, DBT *in_data) {
        int i;
        int num_msgs;
@@ -243,6 +243,33 @@ void export_msglist(int which_cdb, DBT *in_key, DBT *in_data) {
 }
 
 
+// export function for a full text search index record
+// (indexed by an int and the data is arrays of longs)
+void export_fulltext(int which_cdb, DBT *in_key, DBT *in_data) {
+       int i;
+       int num_msgs;
+       long msg;
+
+       // records are indexed by a single "int" and contains an array of zero or more "long"s
+       int indexnum;
+       memcpy(&indexnum, in_key->data, sizeof(int));
+
+       printf("fulltext|%d|", indexnum);
+
+       if (in_data->size > 0) {
+               num_msgs = in_data->size / sizeof(long);
+               for (i=0; i<num_msgs; ++i) {
+                       memcpy(&msg, (in_data->data + (i * sizeof(long))), sizeof(long));
+                       if (i != 0) {
+                               printf(",");
+                       }
+                       printf("%ld", msg);
+               }
+       }
+       printf("|\n");
+}
+
+
 // export function for a visit record
 void export_visit(int which_cdb, DBT *in_key, DBT *in_data) {
        struct visit *visit = (struct visit *)in_data->data;
@@ -364,7 +391,7 @@ void (*export_functions[])(int which_cdb, DBT *in_key, DBT *in_data) = {
        export_dir,             // CDB_DIRECTORY
        export_usetable,        // CDB_USETABLE
        export_bigmsg,          // CDB_BIGMSGS
-       zero_function,          // CDB_FULLTEXT
+       export_fulltext,        // CDB_FULLTEXT
        zero_function,          // CDB_EUIDINDEX
        export_usersbynumber,   // CDB_USERSBYNUMBER
        zero_function,          // CDB_UNUSED1 (obsolete)