yaz-ztest: fix bad usage of session handle
[yaz-moved-to-github.git] / ztest / ztest.c
index 3c96d91..c2b3abd 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2012 Index Data
  * See the file LICENSE for details.
  */
 /** \file
@@ -230,19 +230,20 @@ static void do_delay(const struct delay *delayp)
     }
 }
 
-static void addterms(ODR odr, Z_FacetField *facet_field, const char *facet_name) {
+static void addterms(ODR odr, Z_FacetField *facet_field, const char *facet_name)
+{
     int index;
     int freq = 100;
     int length = strlen(facet_name) + 10;
     char *key = odr_malloc(odr, length);
     key[0] = '\0';
-    for (index = 0; index < facet_field->num_terms; index++) {
-        Z_Term *term;
+    for (index = 0; index < facet_field->num_terms; index++)
+    {
         Z_FacetTerm *facet_term;
         sprintf(key, "%s%d", facet_name, index);
         yaz_log(YLOG_DEBUG, "facet add term %s %d %s", facet_name, index, key);
-        term = term_create(odr, key);
-        facet_term = facet_term_create(odr, term, freq);
+        
+        facet_term = facet_term_create_cstr(odr, key, freq);
         freq = freq - 10 ;
         facet_field_term_set(odr, facet_field, facet_term, index);
     }
@@ -255,7 +256,7 @@ Z_OtherInformation *build_facet_response(ODR odr, Z_FacetList *facet_list) {
     for (index = 0; index < facet_list->num; index++) {
         struct yaz_facet_attr attrvalues;
         yaz_facet_attr_init(&attrvalues);
-        attrvalues.limit = 0;
+        attrvalues.limit = 10;
         yaz_facet_attr_get_z_attributes(facet_list->elements[index]->attributes,
                                         &attrvalues);
         yaz_log(YLOG_LOG, "Attributes: %s %d ", attrvalues.useattr, attrvalues.limit);
@@ -417,13 +418,6 @@ int ztest_search(void *handle, bend_search_rr *rr)
 /* this huge function handles extended services */
 int ztest_esrequest(void *handle, bend_esrequest_rr *rr)
 {
-    /* user-defined handle - created in bend_init */
-    int *counter = (int*) handle;  
-
-    yaz_log(log_level, "ESRequest no %d", *counter);
-
-    (*counter)++;
-
     if (rr->esr->packageName)
         yaz_log(log_level, "packagename: %s", rr->esr->packageName);
     yaz_log(log_level, "Waitaction: " ODR_INT_PRINTF, *rr->esr->waitAction);