limitmap local:* matches against all metadata fields
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 7 Dec 2012 12:55:39 +0000 (13:55 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 7 Dec 2012 12:55:39 +0000 (13:55 +0100)
src/session.c
test/test_limit_limitmap_settings_3.xml

index f3e71fe..8deded8 100644 (file)
@@ -1681,17 +1681,31 @@ static int check_limit_local(struct client *cl,
         if (!name)
             break;
 
-        md_field_id = conf_service_metadata_field_id(service, name);
-        if (md_field_id < 0)
+        if (!strcmp(name, "*"))
         {
-            skip_record = 1;
-            break;
+            for (md_field_id = 0; md_field_id < service->num_metadata;
+                 md_field_id++)
+            {
+                if (match_metadata_local(record, service, md_field_id,
+                                         values, num_v))
+                    break;
+            }
+            if (md_field_id == service->num_metadata)
+                skip_record = 1;
         }
-        if (!match_metadata_local(record, service, md_field_id,
-                                  values, num_v))
+        else
         {
-            skip_record = 1;
-            break;
+            md_field_id = conf_service_metadata_field_id(service, name);
+            if (md_field_id < 0)
+            {
+                skip_record = 1;
+                break;
+            }
+            if (!match_metadata_local(record, service, md_field_id,
+                                      values, num_v))
+            {
+                skip_record = 1;
+            }
         }
     }
     nmem_destroy(nmem_tmp);
index 43bfdee..dd27d89 100644 (file)
@@ -1,5 +1,5 @@
 <settings target="Target-1">
   <set name="pz:limitmap:author"  value="rpn:@attr 1=1003 @attr 6=3" />
   <set name="pz:limitmap:subject" value="rpn:@attr 1=21 @attr 6=3" />
-  <set name="pz:limitmap:Mysubject" value="local:subject" />
+  <set name="pz:limitmap:Mysubject" value="local:*" />
 </settings>