-/* $Id: logic.c,v 1.10 2007-04-19 16:07:20 adam Exp $
+/* $Id: logic.c,v 1.11 2007-04-20 04:08:14 quinn Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
if (cl->state == Client_Idle)
{
- if (cl->requestid != se->requestid && *se->query) {
+ if (cl->requestid != se->requestid && cl->pquery) {
send_search(i);
}
else if (cl->hits > 0 && cl->records < global_parameters.toget &&
}
// Parse the query given the settings specific to this client
-static int client_parse_query(struct client *cl)
+static int client_parse_query(struct client *cl, const char *query)
{
struct session *se = cl->session;
struct ccl_rpn_node *cn;
int cerror, cpos;
- cn = ccl_find_str(cl->database->database->ccl_map, se->query, &cerror, &cpos);
+ cn = ccl_find_str(cl->database->database->ccl_map, query, &cerror, &cpos);
if (!cn)
{
cl->state = Client_Error;
nmem_reset(se->nmem);
criteria = parse_filter(se->nmem, filter);
- strcpy(se->query, query);
se->requestid++;
live_channels = select_targets(se, criteria);
if (live_channels)
se->relevance = 0;
for (cl = se->clients; cl; cl = cl->next)
- if (client_parse_query(cl) < 0) // Query must parse for all targets
+ if (client_parse_query(cl, query) < 0) // Query must parse for all targets
return "QUERY";
for (cl = se->clients; cl; cl = cl->next)
client_prep_connection(cl);
session->requestid = -1;
session->clients = 0;
session->expected_maxrecs = 0;
- session->query[0] = '\0';
session->session_nmem = nmem;
session->nmem = nmem_create();
session->wrbuf = wrbuf_alloc();
-/* $Id: pazpar2.h,v 1.26 2007-04-19 16:07:20 adam Exp $
+/* $Id: pazpar2.h,v 1.27 2007-04-20 04:08:14 quinn Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct session_database *databases; // All databases, settings overriden
struct client *clients; // Clients connected for current search
int requestid;
- char query[1024];
NMEM session_nmem; // Nmem for session-permanent storage
NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
WRBUF wrbuf; // Wrbuf for scratch(i.e. search)