Fix bytarget list not cleared for new search PAZ-1019
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 28 Jul 2015 12:55:25 +0000 (14:55 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 28 Jul 2015 12:55:25 +0000 (14:55 +0200)
src/client.c
src/session.c
test/test_limit_limitmap_34.res
test/test_limit_limitmap_40.res

index 1c53733..5db3018 100644 (file)
@@ -1518,6 +1518,9 @@ int client_parse_query(struct client *cl, const char *query,
     if (!ccl_map)
         return -3;
 
+    xfree(cl->cqlquery);
+    cl->cqlquery = 0;
+
     w_ccl = wrbuf_alloc();
     wrbuf_puts(w_ccl, query);
 
@@ -1530,7 +1533,15 @@ int client_parse_query(struct client *cl, const char *query,
 
     if (apply_limit(cl, facet_limits, w_pqf, ccl_map, service))
     {
+        client_set_state(cl, Client_Error);
         ccl_qual_rm(&ccl_map);
+
+        wrbuf_destroy(w_ccl);
+        wrbuf_destroy(w_pqf);
+
+        xfree(cl->pquery);
+        cl->pquery = 0;
+
         return -2;
     }
 
@@ -1551,6 +1562,10 @@ int client_parse_query(struct client *cl, const char *query,
                     wrbuf_cstr(w_ccl));
         wrbuf_destroy(w_ccl);
         wrbuf_destroy(w_pqf);
+
+        xfree(cl->pquery);
+        cl->pquery = 0;
+
         return -1;
     }
     wrbuf_destroy(w_ccl);
@@ -1592,14 +1607,10 @@ int client_parse_query(struct client *cl, const char *query,
     }
     wrbuf_destroy(w_pqf);
 
-    xfree(cl->cqlquery);
-    cl->cqlquery = 0;
-
     odr_out = odr_createmem(ODR_ENCODE);
     zquery = p_query_rpn(odr_out, cl->pquery);
     if (!zquery)
     {
-
         session_log(se, YLOG_WARN, "Invalid PQF query for Client %s: %s",
                     client_get_id(cl), cl->pquery);
         ret_value = -1;
index b590001..b210f27 100644 (file)
@@ -886,6 +886,7 @@ enum pazpar2_error_code session_search(struct session *se,
         *addinfo = "limit";
         session_leave(se, "session_search");
         se->clients_starting = 0;
+        session_reset_active_clients(se, 0);
         return PAZPAR2_MALFORMED_PARAMETER_VALUE;
     }
 
index 3631c2d..8a59215 100644 (file)
@@ -1,15 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <termlist><activeclients>0</activeclients>
 <list name="xtargets">
-<term>
-<id>Target-1</id>
-<name>ztest-db1</name>
-<frequency>10</frequency>
-<approximation>4</approximation>
-<records>4</records>
-<filtered>6</filtered>
-<state>Client_Idle</state>
-<diagnostic>0</diagnostic>
-</term>
 </list>
 </termlist>
\ No newline at end of file
index 3631c2d..8a59215 100644 (file)
@@ -1,15 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <termlist><activeclients>0</activeclients>
 <list name="xtargets">
-<term>
-<id>Target-1</id>
-<name>ztest-db1</name>
-<frequency>10</frequency>
-<approximation>4</approximation>
-<records>4</records>
-<filtered>6</filtered>
-<state>Client_Idle</state>
-<diagnostic>0</diagnostic>
-</term>
 </list>
 </termlist>
\ No newline at end of file