match correctly any value of filter
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Apr 2010 14:15:37 +0000 (16:15 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Apr 2010 14:15:37 +0000 (16:15 +0200)
lib/MojoFacets/Data.pm

index 7a29fa3..6db5aa2 100644 (file)
@@ -169,9 +169,13 @@ sub _filter_item {
                        last;
                }
                # and match any of values in element
-               $pass = 0;
+               my $have_values = 0;
                foreach my $v ( @{ $i->{$n} } ) { # FIXME not array?
-                       $pass ||= 1 if grep { m/^\Q$v\E$/ } @{ $filters->{$n} };
+                       $have_values ||= 1 if grep { m/^\Q$v\E$/ } @{ $filters->{$n} };
+               }
+               if ( ! $have_values ) {
+                       $pass = 0;
+                       last;
                }
        }
        return $pass;