Gossamer Forum
Home : Products : DBMan : Customization :

case sensitive search not working

Quote Reply
case sensitive search not working
i've set up a searchform with extra .pl and .cfg that searches only one field of my database, a textarea. the problem is that you have to search case sensitive, although i put <input type=hidden name=cs value=off> in the searchform. the normal search with the main .pl searches just fine, not case sensitive.

here's the code i use for the searchform:
Code:
<form action="http://localhost/cgi-bin/dbman/db.cgi" method="GET">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<DIV CLASS=shd>Suchbegriff: <INPUT TYPE="text" NAME="Screenshot" MAXLENGTH="1000">
<INPUT TYPE="SUBMIT" VALUE="Suchen"></DIV><BR>
<INPUT TYPE="hidden" NAME="sb" VALUE="10">
<INPUT TYPE="HIDDEN" NAME="mh" VALUE="10000000000000">
<INPUT TYPE="hidden" NAME="so" VALUE="ascend">
<INPUT TYPE="hidden" NAME="cs" VALUE="off">
<INPUT TYPE=hidden name="view_records" value=1>
</form>
any help is appreciated, thanks

Quote Reply
Re: case sensitive search not working In reply to
Your message is a little unclear but I am guessing you want to do a case sensitive search.

If so use :
<INPUT TYPE="hidden" NAME="cs" VALUE="on">

Quote Reply
Re: case sensitive search not working In reply to
okay, i'll go a little more in detail this time:
i use this search form above for the search in a textarea, where i have links to screenshots. because i don't want the whole field as output, i changed the html_record code to this:
Code:
sub html_record {
my (%rec) = @_;
($db_auto_generate and print &build_html_record(%rec) and return);

@lines = split /\n/,$rec{'Screenshot'};
foreach $line (@lines) {
if ($line =~ /$in{'Screenshot'}/) {
print "$line";
}
}
}
and for html_view_success i have the following:
Code:
sub html_view_success {
if ($in{'keyword'}) {
$search_terms = qq|"$in{'keyword'}" |;
}
else {
foreach $column (@db_cols) {
if ($in{$column}) {
$search_terms .= qq| "$in{$column}" |;
}
}
}

my (@hits) = @_;
my (@lines) = split /\n/,$rec{'Screenshot'};foreach $line (@lines) { if ($line =~ /$in{'Screenshot'}/) { print "$line"; }}
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);

&html_print_headers;
&html_sweetheader;
print qq|
<DIV CLASS=hd>Screenshots</DIV>
<DIV CLASS=tx>Diese Screenshots enthalten den gesuchten Begriff.</DIV><BR>
<UL>
|;
if ($db_next_hits) {
print "<DIV CLASS=shd>Seiten: $db_next_hits</DIV><BR>";
}
for (0 .. $numhits - 1) {
print "";
&html_record (&array_to_hash($_, @hits));
}
if ($db_next_hits) {
print "<BR><DIV CLASS=shd>Seiten: $db_next_hits</DIV><BR>";
}

print qq|
</UL>
|; &html_footer; print qq|
</BODY>
</HTML>
|;
}
the output and everything is just fine, it's just that i want a hit for "cabrio" as for "Cabrio", but only get one when i search for "Cabrio"... any idea what could be wrong?

Quote Reply
Re: case sensitive search not working In reply to
Lateral thought : What result do you get when you omit 'cs=off' from the form input.


Quote Reply
Re: case sensitive search not working In reply to
when i search without the cs=off, it returns:

These screenshots match your search criteria:

but no results are shown.

when i use the cs=off, it returns

There were errors during the search. Reason: no matching records. Please try again.

so there obviously is something wrong with the search... but i can't figure out what it could be.

Quote Reply
Re: case sensitive search not working In reply to
I think DBMan searches case insensitive by default, so you should not need to specify cs=off.

In fact I think (though I could be wrong) it may even work on fuzzy logic i.e.

cs=""=insensitive
cs="*"=sensitive

Try searching with the bare minimum of form input (and code) till you get a result and go from there.


Quote Reply
Re: case sensitive search not working In reply to
i tried several things for the searchform, but without success.

Quote Reply
Re: case sensitive search not working In reply to
$search_terms .= qq| "$in{$column}" |;

Is that a stray dot on this line of code?

Quote Reply
Re: case sensitive search not working In reply to
yes, it is. i removed it and tried several other things... no luck. i think i'll give up :(

thanks for your support.