From: Adam Dickmeiss Date: Tue, 18 Sep 2012 12:40:16 +0000 (+0200) Subject: limitmap: don't use CCL limitmap for relevancy ranking X-Git-Tag: v1.6.19~2 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=824eea389688f854677efd0231182a893d00f8f4;p=pazpar2-moved-to-github.git limitmap: don't use CCL limitmap for relevancy ranking Only the CCL from query is in use for relevancy ranking now. --- diff --git a/src/client.c b/src/client.c index 3578173..9f86ce6 100644 --- a/src/client.c +++ b/src/client.c @@ -1083,17 +1083,12 @@ const char *client_get_facet_limit_local(struct client *cl, static int apply_limit(struct session_database *sdb, facet_limits_t facet_limits, - WRBUF w_pqf, WRBUF w_ccl, - CCL_bibset ccl_map) + WRBUF w_pqf, CCL_bibset ccl_map) { int ret = 0; int i = 0; const char *name; const char *value; - const char **and_op_names = ccl_qual_search_special(ccl_map, "and"); - const char *and_op = and_op_names ? and_op_names[0] : "and"; - const char **or_op_names = ccl_qual_search_special(ccl_map, "or"); - const char *or_op = or_op_names ? or_op_names[0] : "or"; NMEM nmem_tmp = nmem_create(); for (i = 0; (name = facet_limits_get(facet_limits, i, &value)); i++) @@ -1128,20 +1123,34 @@ static int apply_limit(struct session_database *sdb, else if (!strncmp(s->value, "ccl:", 4)) { const char *ccl = s->value + 4; - - wrbuf_printf(w_ccl, " %s (", and_op); - + WRBUF ccl_w = wrbuf_alloc(); for (i = 0; i < num; i++) { - if (i) - wrbuf_printf(w_ccl, " %s ", or_op); - wrbuf_puts(w_ccl, ccl); - wrbuf_puts(w_ccl, "=\""); - wrbuf_puts(w_ccl, values[i]); - wrbuf_puts(w_ccl, "\""); + int cerror, cpos; + struct ccl_rpn_node *cn; + + wrbuf_rewind(ccl_w); + wrbuf_puts(ccl_w, ccl); + wrbuf_puts(ccl_w, "=\""); + wrbuf_puts(ccl_w, values[i]); + wrbuf_puts(ccl_w, "\""); + + cn = ccl_find_str(ccl_map, wrbuf_cstr(ccl_w), + &cerror, &cpos); + if (cn) + { + if (i == 0) + wrbuf_printf(w_pqf, "@and "); + + /* or multiple values.. could be bad if last CCL + parse fails, but this is unlikely to happen */ + if (i < num - 1) + wrbuf_printf(w_pqf, "@or "); + ccl_pquery(w_pqf, cn); + ccl_rpn_delete(cn); + } } - wrbuf_puts(w_ccl, ")"); - + wrbuf_destroy(ccl_w); } else if (!strncmp(s->value, "local:", 6)) { /* no operation */ @@ -1214,7 +1223,7 @@ int client_parse_query(struct client *cl, const char *query, wrbuf_puts(w_pqf, " "); } - if (apply_limit(sdb, facet_limits, w_pqf, w_ccl, ccl_map)) + if (apply_limit(sdb, facet_limits, w_pqf, ccl_map)) { ccl_qual_rm(&ccl_map); return -2; diff --git a/test/test_http_60.res b/test/test_http_60.res index ea3a20e..a0046a5 100644 --- a/test/test_http_60.res +++ b/test/test_http_60.res @@ -26,7 +26,7 @@ XXXXXXXXXX test-usersetting-2 data: YYYYYYYYY -429749 +291121 content: title the religious teachers of greece author adam james medium book \ No newline at end of file diff --git a/test/test_limit_limitmap_15.res b/test/test_limit_limitmap_15.res index 1bb23c0..0c2b760 100644 --- a/test/test_limit_limitmap_15.res +++ b/test/test_limit_limitmap_15.res @@ -17,7 +17,7 @@ Adam, James Reprint of the 1909 ed., which was issued as the 1904-1906 Gifford lectures XXXXXXXXXX -429749 +291121 content: title the religious teachers of greece author adam james \ No newline at end of file