X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flogic.c;h=697da4d50ef95859c8a50121d653ed5a2f5df9fe;hb=cf9d5ca2ac4403ce3864e429d115a6475636ef35;hp=2d035178ce289f708932057d3fb49b35ce727146;hpb=62ae1dbddb3de69cd4a4043d1ae409a19f33da57;p=pazpar2-moved-to-github.git diff --git a/src/logic.c b/src/logic.c index 2d03517..697da4d 100644 --- a/src/logic.c +++ b/src/logic.c @@ -350,17 +350,21 @@ static int prepare_map(struct session *se, struct session_database *sdb) nmem_strsplit(se->session_nmem, ",", s, &stylesheets, &num); for (i = 0; i < num; i++) { + WRBUF fname = conf_get_fname(se->service, stylesheets[i]); + (*m) = nmem_malloc(se->session_nmem, sizeof(**m)); (*m)->next = 0; - + // XSLT if (!strcmp(&stylesheets[i][strlen(stylesheets[i])-4], ".xsl")) { (*m)->marcmap = NULL; - if (!((*m)->stylesheet = conf_load_stylesheet(se->service, stylesheets[i]))) + if (!((*m)->stylesheet = + xsltParseStylesheetFile((xmlChar *) wrbuf_cstr(fname)))) { yaz_log(YLOG_FATAL|YLOG_ERRNO, "Unable to load stylesheet: %s", stylesheets[i]); + wrbuf_destroy(fname); return -1; } } @@ -368,14 +372,15 @@ static int prepare_map(struct session *se, struct session_database *sdb) else if (!strcmp(&stylesheets[i][strlen(stylesheets[i])-5], ".mmap")) { (*m)->stylesheet = NULL; - if (!((*m)->marcmap = marcmap_load(stylesheets[i], se->session_nmem))) + if (!((*m)->marcmap = marcmap_load(wrbuf_cstr(fname), se->session_nmem))) { yaz_log(YLOG_FATAL|YLOG_ERRNO, "Unable to load marcmap: %s", stylesheets[i]); + wrbuf_destroy(fname); return -1; } } - + wrbuf_destroy(fname); m = &(*m)->next; } } @@ -500,10 +505,14 @@ static struct database_criterion *parse_filter(NMEM m, const char *buf) int subnum; int subi; struct database_criterion *new = nmem_malloc(m, sizeof(*new)); - char *eq = strchr(values[i], '='); + char *eq; + if (eq = strchr(values[i], '=')) + new->type = PAZPAR2_STRING_MATCH; + if (eq = strchr(values[i], '~')) + new->type = PAZPAR2_SUBSTRING_MATCH; if (!eq) { - yaz_log(YLOG_WARN, "Missing equal-sign in filter"); + yaz_log(YLOG_WARN, "Missing equal-signi/tilde in filter"); return 0; } *(eq++) = '\0';