PAZ-1013: Do not re-search if facet-id mapping not found
[pazpar2-moved-to-github.git] / src / client.c
index 6e84061..5ebc11c 100644 (file)
@@ -1387,11 +1387,21 @@ static int apply_limit(struct client *cl,
                     const char *id = session_lookup_id_facet(cl->session,
                                                              cl, name,
                                                              values[i]);
-                    if (id) {
-                        values[i] = nmem_strdup(nmem_tmp, id);
-                        yaz_log(YLOG_DEBUG, 
-                            "apply_limit: s='%s' found id '%s'",s->name,id );
-                        
+                    if (id)
+                    {
+                        if ( *id )
+                        {
+                            values[i] = nmem_strdup(nmem_tmp, id);
+                            yaz_log(YLOG_DEBUG,
+                                "apply_limit: s='%s' found id '%s'",s->name,id );
+                        }
+                        else
+                        {
+                            yaz_log(YLOG_DEBUG,
+                                "apply_limit: %s: term '%s' not found, failing client",
+                                s->name, values[i] );
+                            ret = -1;
+                        }
                     }
                 }
                 nmem_strsplit_escape2(nmem_tmp, ",", s->value, &cvalues,