int i = 0;
const char *name;
const char *value;
+ NMEM nmem_tmp = nmem_create();
for (i = 0; (name = facet_limits_get(facet_limits, i, &value)); i++)
{
struct setting *s = 0;
const char *p = strchr(s->name + 3, ':');
if (p && !strcmp(p + 1, name) && s->value)
{
+ char **values = 0;
+ int i, num = 0;
+ nmem_strsplit_escape2(nmem_tmp, "|", value, &values,
+ &num, 1, '\\', 1);
+
if (!strncmp(s->value, "rpn:", 4))
{
const char *pqf = s->value + 4;
+
wrbuf_puts(w_pqf, "@and ");
wrbuf_puts(w_pqf, pqf);
wrbuf_puts(w_pqf, " ");
- yaz_encode_pqf_term(w_pqf, value, strlen(value));
+ for (i = 0; i < num; i++)
+ {
+ if (i < num - 1)
+ wrbuf_puts(w_pqf, "@or ");
+ yaz_encode_pqf_term(w_pqf, values[i],
+ strlen(values[i]));
+ }
}
else if (!strncmp(s->value, "ccl:", 4))
{
const char *ccl = s->value + 4;
- wrbuf_puts(w_ccl, " and ");
- wrbuf_puts(w_ccl, ccl);
- wrbuf_puts(w_ccl, "=\"");
- wrbuf_puts(w_ccl, value);
- wrbuf_puts(w_ccl, "\"");
+
+ wrbuf_puts(w_ccl, " and (");
+
+ for (i = 0; i < num; i++)
+ {
+ if (i)
+ wrbuf_puts(w_ccl, " or ");
+ wrbuf_puts(w_ccl, ccl);
+ wrbuf_puts(w_ccl, "=\"");
+ wrbuf_puts(w_ccl, values[i]);
+ wrbuf_puts(w_ccl, "\"");
+ }
+ wrbuf_puts(w_ccl, ")");
+
}
break;
}
}
+ nmem_reset(nmem_tmp);
if (!s)
{
yaz_log(YLOG_WARN, "Target %s: limit %s used, but no limitmap defined",
(sdb->database ? sdb->database->url : "<no url>"), name);
}
}
+ nmem_destroy(nmem_tmp);
}
// Parse the query given the settings specific to this client
fl->num = 0;
fl->darray = 0;
if (param)
- nmem_strsplit_escape(fl->nmem, ",", param, &fl->darray,
- &fl->num, 1, '\\');
+ nmem_strsplit_escape2(fl->nmem, ",", param, &fl->darray,
+ &fl->num, 1, '\\', 0);
/* replace = with \0 .. for each item */
for (i = 0; i < fl->num; i++)
{
http://localhost:9763/search.pz2?session=8&command=search&query=a+and
1 http://localhost:9763/search.pz2?session=8&command=show&block=1
http://localhost:9763/search.pz2?command=init&pz:limitmap:author%5Bz3950.indexdata.com%2Fmarc%5D=ccl:author_phrase
-1 http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3dadam\,+james
+1 http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3dadam\,+james%7Cother_author
1 http://localhost:9763/search.pz2?session=9&command=show&block=1
http://localhost:9763/search.pz2?session=9&command=settings&pz:limitmap:author%5Bz3950.indexdata.com%2Fmarc%5D=rpn:%40attr+1%3d1003+%40attr+6%3d3
-1 http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3dadam\,+james
+1 http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3dadam\,+james%7Cother_author
1 http://localhost:9763/search.pz2?session=9&command=show&block=1