From f8892da7570d4e365d36d2de128cc581f5240980 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Mon, 1 Dec 2008 05:10:31 +0000 Subject: [PATCH] Added setting to specify pqf prefix, to support database subset selection, etc. --- doc/pazpar2_conf.xml | 13 +++++++++++++ src/client.c | 6 ++++++ src/settings.c | 1 + src/settings.h | 1 + 4 files changed, 21 insertions(+) diff --git a/doc/pazpar2_conf.xml b/doc/pazpar2_conf.xml index b75981d..f81464a 100644 --- a/doc/pazpar2_conf.xml +++ b/doc/pazpar2_conf.xml @@ -820,6 +820,19 @@ + + + pz:pqf_prefix + + + Allows you to specify an arbitrary PQF query language substring. The provided + string is prefixed the user's query after it has been normalized to PQF + internally in pazpar2. This allows you to attach complex 'filters' to + queries for a gien target, sometimes necessary to select sub-catalogs + in union catalog systems, etc. + + + diff --git a/src/client.c b/src/client.c index 0a8860d..ad63e3c 100644 --- a/src/client.c +++ b/src/client.c @@ -591,6 +591,7 @@ int client_parse_query(struct client *cl, const char *query) int cerror, cpos; CCL_bibset ccl_map = prepare_cclmap(cl); const char *sru = session_setting_oneval(sdb, PZ_SRU); + const char *pqf_prefix = session_setting_oneval(sdb, PZ_PQF_PREFIX); if (!ccl_map) return -1; @@ -605,6 +606,11 @@ int client_parse_query(struct client *cl, const char *query) return -1; } wrbuf_rewind(se->wrbuf); + if (*pqf_prefix) + { + wrbuf_puts(se->wrbuf, pqf_prefix); + wrbuf_puts(se->wrbuf, " "); + } ccl_pquery(se->wrbuf, cn); xfree(cl->pquery); cl->pquery = xstrdup(wrbuf_cstr(se->wrbuf)); diff --git a/src/settings.c b/src/settings.c index 8ab368a..284ed84 100644 --- a/src/settings.c +++ b/src/settings.c @@ -65,6 +65,7 @@ static char *hard_settings[] = { "pz:apdulog", "pz:sru", "pz:sru_version", + "pz:pqf_prefix", 0 }; diff --git a/src/settings.h b/src/settings.h index ca0af1f..7678ab5 100644 --- a/src/settings.h +++ b/src/settings.h @@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define PZ_APDULOG 14 #define PZ_SRU 15 #define PZ_SRU_VERSION 16 +#define PZ_PQF_PREFIX 17 struct setting { -- 1.7.10.4