X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-query.c;h=a9b0941db5d49c90f276069971b773d897bed78d;hp=c495becdf2cd7819780204d28ce1c3dc8a5c6e15;hb=5c1eb188e9cf6f0dd2e435a1f81938f258515edb;hpb=0c46d2e66bdeea1600e700124a81a5d0a65d349e diff --git a/src/zoom-query.c b/src/zoom-query.c index c495bec..a9b0941 100644 --- a/src/zoom-query.c +++ b/src/zoom-query.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** @@ -136,15 +136,19 @@ Z_SortKeySpecList *ZOOM_query_get_sortspec(ZOOM_query s) return s->sort_strategy == SORT_STRATEGY_Z3950 ? s->sort_spec : 0; } -static void cql2pqf_wrbuf_puts(const char *buf, void *client_data) +const char *ZOOM_query_get_query_string(ZOOM_query s) { - WRBUF wrbuf = (WRBUF) client_data; - wrbuf_puts(wrbuf, buf); + return wrbuf_cstr(s->full_query); } -const char *ZOOM_query_get_query_string(ZOOM_query s) +void ZOOM_query_get_hash(ZOOM_query s, WRBUF w) { - return wrbuf_cstr(s->full_query); + wrbuf_printf(w, "%d;", s->query_type); + if (s->query_string) + wrbuf_puts(w, s->query_string); + wrbuf_printf(w, ";%d;", s->sort_strategy); + if (s->sort_spec) + yaz_sort_spec_to_type7(s->sort_spec, w); } /* @@ -184,7 +188,7 @@ static char *cql2pqf(ZOOM_connection c, const char *cql) { WRBUF wrbuf_result = wrbuf_alloc(); error = cql_transform(trans, cql_parser_result(parser), - cql2pqf_wrbuf_puts, wrbuf_result); + wrbuf_vp_puts, wrbuf_result); if (error != 0) { char buf[512]; const char *addinfo; @@ -367,7 +371,7 @@ ZOOM_query_sortby2(ZOOM_query s, const char *strategy, const char *criteria) odr_reset(s->odr_sort_spec); s->sort_spec = yaz_sort_spec(s->odr_sort_spec, criteria); if (!s->sort_spec) - return -1; + return -2; return generate(s); }