Check number of logical records when firing watches
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Nov 2011 13:11:25 +0000 (14:11 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Nov 2011 13:11:25 +0000 (14:11 +0100)
This is to ensure we don't fire watches prematurely.. Say that first
search/present response includes NO records that make it through
filtering.

src/client.c

index d205bef..ac2e01b 100644 (file)
@@ -555,12 +555,15 @@ void client_got_records(struct client *cl)
     struct session *se = cl->session;
     if (se)
     {
-        client_unlock(cl);
-        session_alert_watch(se, SESSION_WATCH_SHOW);
-        session_alert_watch(se, SESSION_WATCH_BYTARGET);
-        session_alert_watch(se, SESSION_WATCH_TERMLIST);
-        session_alert_watch(se, SESSION_WATCH_RECORD);
-        client_lock(cl);
+        if (reclist_get_num_records(se->reclist) > 0)
+        {
+            client_unlock(cl);
+            session_alert_watch(se, SESSION_WATCH_SHOW);
+            session_alert_watch(se, SESSION_WATCH_BYTARGET);
+            session_alert_watch(se, SESSION_WATCH_TERMLIST);
+            session_alert_watch(se, SESSION_WATCH_RECORD);
+            client_lock(cl);
+        }
     }
 }