Substring for all setting types.
[pazpar2-moved-to-github.git] / src / database.c
index e030ecc..0a87d0c 100644 (file)
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <assert.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <yaz/log.h>
 
 #include "pazpar2.h"
 #include "host.h"
@@ -240,14 +241,22 @@ static int match_criterion(struct setting **settings,
         return 0;
     for (v = c->values; v; v = v->next)
     {
-        if (offset == PZ_ID)
+        if (c->type == PAZPAR2_STRING_MATCH)
         {
-            if (match_zurl(settings[offset]->value, v->value))
-                break;
-        }
-        else 
+            if (offset == PZ_ID)
+            {
+                if (match_zurl(settings[offset]->value, v->value))
+                    break;
+            }
+            else 
+            {
+                if (!strcmp(settings[offset]->value, v->value))
+                    break;
+            }
+        }            
+        else if (c->type == PAZPAR2_SUBSTRING_MATCH)
         {
-            if (!strcmp(settings[offset]->value, v->value))
+            if (strstr(settings[offset]->value, v->value))
                 break;
         }
     }