From 1dffec9e775d80551fe3a05a3b22232e7fe1676b Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Mon, 16 Aug 2010 16:25:21 +0200 Subject: [PATCH 1/1] SOLR support (work in progress) Add logic to branch between SRU and SOLR targets. Setting sru specific to value "solr" will enable parsing to SOLR. --- src/client.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/client.c b/src/client.c index cb5088d..e69f832 100644 --- a/src/client.c +++ b/src/client.c @@ -51,6 +51,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #define USE_TIMING 0 #if USE_TIMING @@ -562,6 +563,7 @@ static int client_set_facets_request(struct client *cl, ZOOM_connection link) const char *opt_facet_term_sort = session_setting_oneval(sdb, PZ_TERMLIST_TERM_SORT); const char *opt_facet_term_count = session_setting_oneval(sdb, PZ_TERMLIST_TERM_COUNT); /* Disable when no count is set */ + /* TODO Verify: Do we need to reset the ZOOM facets if a ZOOM Connection is being reused??? */ if (opt_facet_term_count && *opt_facet_term_count) { int index = 0; @@ -845,7 +847,7 @@ static char *make_cqlquery(struct client *cl) // TODO Could prob. be merge with the similar make_cqlquery static char *make_solrquery(struct client *cl) { - cql_transform_t sqlt = solr_transform_create(); + solr_transform_t sqlt = solr_transform_create(); Z_RPNQuery *zquery; char *r; WRBUF wrb = wrbuf_alloc(); @@ -865,7 +867,7 @@ static char *make_solrquery(struct client *cl) } wrbuf_destroy(wrb); odr_destroy(odr_out); - cql_transform_close(sqlt); + solr_transform_close(sqlt); return r; } @@ -926,10 +928,14 @@ int client_parse_query(struct client *cl, const char *query) xfree(cl->cqlquery); if (*sru) { - if (!strcmp(sru, "solr") - - if (!(cl->cqlquery = make_cqlquery(cl))) - return -1; + if (!strcmp(sru, "solr")) { + if (!(cl->cqlquery = make_solrquery(cl))) + return -1; + } + else { + if (!(cl->cqlquery = make_cqlquery(cl))) + return -1; + } } else cl->cqlquery = 0; -- 1.7.10.4