]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
plugins: fts-solr: Move solr_lookup_add_doc() from solr-connection.c to solr-response.c.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 8 Oct 2019 16:56:56 +0000 (18:56 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 9 Jan 2020 12:52:43 +0000 (12:52 +0000)
src/plugins/fts-solr/solr-connection.c
src/plugins/fts-solr/solr-response.c

index c9cdde746e10460be94cb2cf4bd0539f33c2a8c3..f6d0639f16bd7f938661341b9398bb9856d2e1aa 100644 (file)
@@ -126,44 +126,6 @@ void solr_connection_deinit(struct solr_connection **_conn)
        i_free(conn);
 }
 
-static int solr_lookup_add_doc(struct solr_lookup_xml_context *ctx)
-{
-       struct fts_score_map *score;
-       struct solr_result *result;
-       const char *box_id;
-
-       if (ctx->uid == 0) {
-               i_error("fts_solr: uid missing from inside doc");
-               return -1;
-       }
-
-       if (ctx->mailbox == NULL) {
-               /* looking up from a single mailbox only */
-               box_id = "";
-       } else if (ctx->uidvalidity != 0) {
-               /* old style lookup */
-               string_t *str = t_str_new(64);
-               str_printfa(str, "%u\001", ctx->uidvalidity);
-               str_append(str, ctx->mailbox);
-               if (ctx->ns != NULL)
-                       str_printfa(str, "\001%s", ctx->ns);
-               box_id = str_c(str);
-       } else {
-               /* new style lookup */
-               box_id = ctx->mailbox;
-       }
-       result = solr_result_get(ctx, box_id);
-
-       if (seq_range_array_add(&result->uids, ctx->uid)) {
-               /* duplicate result */
-       } else if (ctx->score != 0) {
-               score = array_append_space(&result->scores);
-               score->uid = ctx->uid;
-               score->score = ctx->score;
-       }
-       return 0;
-}
-
 static void solr_lookup_xml_end(void *context, const char *name ATTR_UNUSED)
 {
        struct solr_lookup_xml_context *ctx = context;
index da55cde26c92f89eab9a8d030f0e43225c6cb625..baec9f39637a2e3e949c49353353c017543488bf 100644 (file)
@@ -148,3 +148,40 @@ solr_result_get(struct solr_lookup_xml_context *ctx, const char *box_id)
        return result;
 }
 
+static int solr_lookup_add_doc(struct solr_lookup_xml_context *ctx)
+{
+       struct fts_score_map *score;
+       struct solr_result *result;
+       const char *box_id;
+
+       if (ctx->uid == 0) {
+               i_error("fts_solr: uid missing from inside doc");
+               return -1;
+       }
+
+       if (ctx->mailbox == NULL) {
+               /* looking up from a single mailbox only */
+               box_id = "";
+       } else if (ctx->uidvalidity != 0) {
+               /* old style lookup */
+               string_t *str = t_str_new(64);
+               str_printfa(str, "%u\001", ctx->uidvalidity);
+               str_append(str, ctx->mailbox);
+               if (ctx->ns != NULL)
+                       str_printfa(str, "\001%s", ctx->ns);
+               box_id = str_c(str);
+       } else {
+               /* new style lookup */
+               box_id = ctx->mailbox;
+       }
+       result = solr_result_get(ctx, box_id);
+
+       if (seq_range_array_add(&result->uids, ctx->uid)) {
+               /* duplicate result */
+       } else if (ctx->score != 0) {
+               score = array_append_space(&result->scores);
+               score->uid = ctx->uid;
+               score->score = ctx->score;
+       }
+       return 0;
+}