ZOOM_resultset_record_immedate never makes RECV_RECORD event
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 4 Feb 2014 13:40:55 +0000 (14:40 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 4 Feb 2014 13:40:55 +0000 (14:40 +0100)
Fixes test_http_86 for Pazpar2.

src/zoom-c.c
src/zoom-p.h
src/zoom-record-cache.c

index 3d38105..b1f5aca 100644 (file)
@@ -1128,7 +1128,7 @@ ZOOM_API(ZOOM_record)
     const char *schema =
         ZOOM_options_get(s->options, "schema");
 
-    return ZOOM_record_cache_lookup(s, pos, syntax, elementSetName, schema);
+    return ZOOM_record_cache_lookup_i(s, pos, syntax, elementSetName, schema);
 }
 
 ZOOM_API(ZOOM_record)
index 4372ece..3cb9b80 100644 (file)
@@ -288,7 +288,10 @@ Z_NamePlusRecord *ZOOM_memcached_lookup(ZOOM_resultset r, int pos,
                                         const char *syntax,
                                         const char *elementSetName,
                                         const char *schema);
-
+ZOOM_record ZOOM_record_cache_lookup_i(ZOOM_resultset r, int pos,
+                                       const char *syntax,
+                                       const char *elementSetName,
+                                       const char *schema);
 void ZOOM_handle_facet_result(ZOOM_connection c, ZOOM_resultset r,
                               Z_OtherInformation *o);
 void ZOOM_handle_search_result(ZOOM_connection c, ZOOM_resultset resultset,
index fe1aeec..957e8f9 100644 (file)
@@ -131,31 +131,43 @@ void ZOOM_record_cache_add(ZOOM_resultset r, Z_NamePlusRecord *npr,
     ZOOM_memcached_add(r, npr, pos, syntax, elementSetName, schema, diag);
 }
 
-ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
-                                     const char *syntax,
-                                     const char *elementSetName,
-                                     const char *schema)
+ZOOM_record ZOOM_record_cache_lookup_i(ZOOM_resultset r, int pos,
+                                       const char *syntax,
+                                       const char *elementSetName,
+                                       const char *schema)
 {
     ZOOM_record_cache rc;
-    Z_NamePlusRecord *npr;
 
     for (rc = r->record_hash[record_hash(pos)]; rc; rc = rc->next)
     {
         if (pos == rc->pos)
         {
-            ZOOM_Event event;
             if (yaz_strcmp_null(schema, rc->schema))
                 continue;
             if (yaz_strcmp_null(elementSetName,rc->elementSetName))
                 continue;
             if (yaz_strcmp_null(syntax, rc->syntax))
                 continue;
-            event = ZOOM_Event_create(ZOOM_EVENT_RECV_RECORD);
-            ZOOM_connection_put_event(r->connection, event);
-
             return &rc->rec;
         }
     }
+    return 0;
+}
+
+ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
+                                     const char *syntax,
+                                     const char *elementSetName,
+                                     const char *schema)
+{
+    Z_NamePlusRecord *npr;
+    ZOOM_record rec = ZOOM_record_cache_lookup_i(r, pos, syntax,
+                                                 elementSetName, schema);
+    if (rec)
+    {
+        ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_RECV_RECORD);
+        ZOOM_connection_put_event(r->connection, event);
+        return rec;
+    }
     npr = ZOOM_memcached_lookup(r, pos, syntax, elementSetName, schema);
     if (npr)
         return record_cache_add(r, npr, pos, syntax, elementSetName,