Update lib version for metaproxy from 5 to 6 MP-506
[metaproxy-moved-to-github.git] / src / filter_zoom.cpp
index b9567e6..c395a5c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2013 Index Data
+   Copyright (C) Index Data
 
 Metaproxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -426,14 +426,23 @@ void yf::Zoom::Backend::search(ZOOM_query q, Odr_int *hits,
             ae->value.complex->semanticAction = 0;
 
             int num_terms = ZOOM_facet_field_term_count(ff);
-            fl->elements[i] = facet_field_create(odr, al, num_terms);
+            fl->elements[i] = (Z_FacetField *)
+                odr_malloc(odr, sizeof(Z_FacetField));
+            fl->elements[i]->attributes = al;
+            fl->elements[i]->num_terms = num_terms;
+            fl->elements[i]->terms = (Z_FacetTerm **)
+                odr_malloc(odr, num_terms * sizeof(Z_FacetTerm *));
             int j;
             for (j = 0; j < num_terms; j++)
             {
                 int freq;
                 const char *a_term = ZOOM_facet_field_get_term(ff, j, &freq);
-                fl->elements[i]->terms[j] =
-                    facet_term_create_cstr(odr, a_term, freq);
+                Z_FacetTerm *ft = (Z_FacetTerm *) odr_malloc(odr, sizeof(*ft));
+                ft->term = z_Term_create(odr, Z_Term_general, a_term,
+                                         strlen(a_term));
+                ft->count = odr_intdup(odr, freq);
+
+                fl->elements[i]->terms[j] = ft;
             }
         }
         fl->num = i;
@@ -1463,6 +1472,9 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases(
             out_names[no_out_args] = "subdatabase";
             out_values[no_out_args++] = odr_strdup(odr, sptr->cfSubDB.c_str());
         }
+        if (!param_nocproxy && b->sptr->contentConnector.length())
+            param_nocproxy = "1";
+
         if (param_nocproxy)
         {
             out_names[no_out_args] = "nocproxy";