From 22c19c698f72ce5328ea6d5d685c019be92d24d3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 23 Jan 2014 11:40:33 +0100 Subject: [PATCH] zoom: cache hit count --- src/zoom-c.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/zoom-c.c b/src/zoom-c.c index 241444f..6e0a883 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -752,6 +752,7 @@ ZOOM_API(ZOOM_resultset) yaz_log(c->log_api, "%p ZOOM_connection_search set %p query %p", c, r, q); r->r_sort_spec = ZOOM_query_get_sortspec(q); r->query = q; + ZOOM_query_addref(q); r->options = ZOOM_options_create_with_parent(c->options); @@ -789,8 +790,20 @@ ZOOM_API(ZOOM_resultset) wrbuf_len(r->mc_key), &v_len, &flags, &rc); if (v) { - yaz_log(YLOG_LOG, "For key %s got value %.*s", - wrbuf_cstr(r->mc_key), (int) v_len, v); + ZOOM_Event event; + WRBUF w = wrbuf_alloc(); + + wrbuf_write(w, v, v_len); + free(v); + r->size = odr_atoi(wrbuf_cstr(w)); + + yaz_log(YLOG_LOG, "For key %s got value %s", + wrbuf_cstr(r->mc_key), wrbuf_cstr(w)); + + wrbuf_destroy(w); + event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH); + ZOOM_connection_put_event(c, event); + return r; } else { @@ -829,8 +842,6 @@ ZOOM_API(ZOOM_resultset) ZOOM_resultset_addref(r); - ZOOM_query_addref(q); - if (!c->async) { while (ZOOM_event(1, &c)) -- 1.7.10.4