* Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.146 2002-03-06 01:22:41 adam Exp $
+ * $Id: client.c,v 1.150 2002-04-15 11:19:32 adam Exp $
*/
#include <stdio.h>
static CCL_bibset bibset; /* CCL bibset handle */
#endif
+#if HAVE_READLINE_COMPLETION_OVER
+
+#else
+/* readline doesn't have this var. Define it ourselves. */
+int rl_attempted_completion_over = 0;
+#endif
/* set this one to 1, to avoid decode of unknown MARCs */
#define AVOID_MARC_DECODE 1
return 2;
}
+/* display Query Expression as part of searchResult-1 */
+static void display_queryExpression (Z_QueryExpression *qe)
+{
+ if (!qe)
+ return;
+ if (qe->which == Z_QueryExpression_term)
+ {
+ if (qe->u.term->queryTerm)
+ {
+ Z_Term *term = qe->u.term->queryTerm;
+ if (term->which == Z_Term_general)
+ printf (" %.*s", term->u.general->len, term->u.general->buf);
+ }
+ }
+
+}
+
+/* see if we can find USR:SearchResult-1 */
+static void display_searchResult (Z_OtherInformation *o)
+{
+ int i;
+ if (!o)
+ return ;
+ for (i = 0; i < o->num_elements; i++)
+ {
+ if (o->list[i]->which == Z_OtherInfo_externallyDefinedInfo)
+ {
+ Z_External *ext = o->list[i]->information.externallyDefinedInfo;
+
+ if (ext->which == Z_External_searchResult1)
+ {
+ int j;
+ Z_SearchInfoReport *sr = ext->u.searchResult1;
+ printf ("SearchResult-1:");
+ for (j = 0; j < sr->num; j++)
+ {
+ if (!sr->elements[j]->subqueryExpression)
+ printf (" %d", j);
+ display_queryExpression (
+ sr->elements[j]->subqueryExpression);
+ display_queryExpression (
+ sr->elements[j]->subqueryInterpretation);
+ display_queryExpression (
+ sr->elements[j]->subqueryRecommendation);
+ if (sr->elements[j]->subqueryCount)
+ printf ("(%d)", *sr->elements[j]->subqueryCount);
+ }
+ printf ("\n");
+ }
+ }
+ }
+}
+
static int process_searchResponse(Z_SearchResponse *res)
{
printf ("Received SearchResponse.\n");
printf("Number of hits: %d", *res->resultCount);
if (setnumber >= 0)
printf (", setno %d", setnumber);
- printf("\nrecords returned: %d\n",
+ printf ("\n");
+ display_searchResult (res->additionalSearchInfo);
+ printf("records returned: %d\n",
*res->numberOfRecordsReturned);
setno += *res->numberOfRecordsReturned;
if (res->records)
{
printf("Unknown command: %s.\n", word);
cmd_help ("");
-
+ res = 1;
}
if(apdu_file) fflush(apdu_file);