/* This file is part of Pazpar2.
- Copyright (C) 2006-2010 Index Data
+ Copyright (C) 2006-2011 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
}
else
{
+ yaz_log(YLOG_DEBUG, "client_search_response: hits "
+ ODR_INT_PRINTF, cl->hits);
client_report_facets(cl, resultset);
cl->record_offset = cl->startrecs;
cl->hits = ZOOM_resultset_size(resultset);
- if (se)
+ if (se) {
se->total_hits += cl->hits;
+ yaz_log(YLOG_DEBUG, "client_search_response: total hits "
+ ODR_INT_PRINTF, se->total_hits);
+ }
}
}
struct client *client_create(void)
{
- struct client *r = xmalloc(sizeof(*r));
- r->maxrecs = 100;
- r->startrecs = 0;
- r->pquery = 0;
- r->cqlquery = 0;
- r->database = 0;
- r->connection = 0;
- r->session = 0;
- r->hits = 0;
- r->record_offset = 0;
- r->diagnostic = 0;
- r->state = Client_Disconnected;
- r->show_raw = 0;
- r->resultset = 0;
- r->mutex = 0;
- pazpar2_mutex_create(&r->mutex, "client");
- r->preferred = 0;
- r->ref_count = 1;
+ struct client *cl = xmalloc(sizeof(*cl));
+ cl->maxrecs = 100;
+ cl->startrecs = 0;
+ cl->pquery = 0;
+ cl->cqlquery = 0;
+ cl->database = 0;
+ cl->connection = 0;
+ cl->session = 0;
+ cl->hits = 0;
+ cl->record_offset = 0;
+ cl->diagnostic = 0;
+ cl->state = Client_Disconnected;
+ cl->show_raw = 0;
+ cl->resultset = 0;
+ cl->mutex = 0;
+ pazpar2_mutex_create(&cl->mutex, "client");
+ cl->preferred = 0;
+ cl->ref_count = 1;
client_use(1);
- return r;
+ return cl;
}
void client_lock(struct client *c)
if (!cn)
{
client_set_state(cl, Client_Error);
- yaz_log(YLOG_WARN, "Failed to parse CCL query %s for %s",
+ session_log(se, YLOG_WARN, "Failed to parse CCL query '%s' for %s",
query,
client_get_database(cl)->database->url);
return -1;
cl->maxrecs = v;
}
+int client_get_maxrecs(struct client *cl)
+{
+ return cl->maxrecs;
+}
+
void client_set_startrecs(struct client *cl, int v)
{
cl->startrecs = v;