[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Need exact matches in category not substring (WHERE = vs. WHERE LIKE %%)
Quoting John Young (john_young@sonic.net):
> Hi, everyone.
>
> If one were to take the Foundation demo with IC 4.8.3 using MySQL 3.23.44
> (SQLDSN dbi:mysql:dbname / perl 5.6.1 / Linux 2.4.10)
> and add categories such that one had category names like:
>
> Metal
> Metal Discs
>
> How does one avoid having both categories display when only
> "Metal" is selected?
>
>
> Essentially, I want results just like you would get from:
>
> SELECT title FROM products WHERE category = "Metal";
>
> but instead I am getting results like you would get from:
>
> SELECT title FROM products WHERE category LIKE "%Metal%";
>
> when using the default link from [cat-exec bar_link]cat[/cat-exec]
> in foundation/templates/components/category_vertical.
>
>
You have found a bug, thank you!
A workaround is to use this for now:
[page href=scan
arg="
co=yes
st=db
sf=category
op=em
se=Metal
os=yes
"]try it</A>
The os=yes avoids the false filter function which is getting done, even
though there is nothing to OR.
The real fix is this patch to lib/Vend/Search.pm:
--- /tmp/Search.pm Tue Feb 5 22:12:40 2002
+++ lib/Vend/Search.pm Tue Feb 5 22:14:38 2002
@@ -255,9 +255,9 @@
if( $s->{mv_column_op}[$i] =~ /([=][~]|rm|em)/ ) {
$specs[$i] = quotemeta $specs[$i]
if $s->{mv_all_chars}[$i];
- $s->{regex_specs} = []
- unless $s->{regex_specs};
last COLOP if $s->{mv_begin_string}[$i];
+ last COLOP if $s->{mv_column_op}[$i] eq 'em';
+ $s->{regex_specs} ||= [];
$specs[$i] =~ /(.*)/;
push @{$s->{regex_specs}}, $1
}
@@ -716,6 +716,7 @@
#::logDebug("coderef=" . ::uneval_it(\@code));
undef $f if $s->{mv_search_relate} =~ s/\bor\b/or/ig;
+ undef $f unless $s->{regex_specs} or $s->{eq_specs};
DOLIMIT: {
#::logDebug(::uneval_it({%$s}));
#::logDebug("do_limit.");
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Prove you aren't stupid. Say NO to Passport.