Configurable length of termlist entries. Print max. 10 items for
[pazpar2-moved-to-github.git] / src / client.c
index 1acd2ea..ff3c0fb 100644 (file)
@@ -35,7 +35,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <unistd.h>
 #endif
 #include <signal.h>
-#include <ctype.h>
 #include <assert.h>
 
 #include <yaz/marcdisp.h>
@@ -74,7 +73,6 @@ struct client {
     char *cqlquery; // used for SRU targets only
     int hits;
     int record_offset;
-    int setno;
     int diagnostic;
     enum client_state state;
     struct show_raw *show_raw;
@@ -99,9 +97,7 @@ static const char *client_states[] = {
     "Client_Working",
     "Client_Error",
     "Client_Failed",
-    "Client_Disconnected",
-    "Client_Stopped",
-    "Client_Continue"
+    "Client_Disconnected"
 };
 
 static struct client *client_freelist = 0;
@@ -460,13 +456,17 @@ void client_start_search(struct client *cl)
 
     if (cl->cqlquery)
     {
+        yaz_log(YLOG_LOG, "Search %s CQL: %s", sdb->database->url, cl->cqlquery);
         ZOOM_query q = ZOOM_query_create();
         ZOOM_query_cql(q, cl->cqlquery);
         rs = ZOOM_connection_search(link, q);
         ZOOM_query_destroy(q);
     }
     else
+    {
+        yaz_log(YLOG_LOG, "Search %s PQF: %s", sdb->database->url, cl->pquery);
         rs = ZOOM_connection_search_pqf(link, cl->pquery);
+    }
     connection_set_resultset(co, rs);
     connection_continue(co);
 }
@@ -488,7 +488,6 @@ struct client *client_create(void)
     r->session = 0;
     r->hits = 0;
     r->record_offset = 0;
-    r->setno = 0;
     r->diagnostic = 0;
     r->state = Client_Disconnected;
     r->show_raw = 0;
@@ -596,6 +595,7 @@ int client_parse_query(struct client *cl, const char *query)
     int cerror, cpos;
     CCL_bibset ccl_map = prepare_cclmap(cl);
     const char *sru = session_setting_oneval(sdb, PZ_SRU);
+    const char *pqf_prefix = session_setting_oneval(sdb, PZ_PQF_PREFIX);
 
     if (!ccl_map)
         return -1;
@@ -610,6 +610,11 @@ int client_parse_query(struct client *cl, const char *query)
         return -1;
     }
     wrbuf_rewind(se->wrbuf);
+    if (*pqf_prefix)
+    {
+        wrbuf_puts(se->wrbuf, pqf_prefix);
+        wrbuf_puts(se->wrbuf, " ");
+    }
     ccl_pquery(se->wrbuf, cn);
     xfree(cl->pquery);
     cl->pquery = xstrdup(wrbuf_cstr(se->wrbuf));
@@ -647,8 +652,7 @@ void client_set_session(struct client *cl, struct session *se)
 
 int client_is_active(struct client *cl)
 {
-    if (cl->connection && (cl->state == Client_Continue ||
-                           cl->state == Client_Connecting ||
+    if (cl->connection && (cl->state == Client_Connecting ||
                            cl->state == Client_Working))
         return 1;
     return 0;