changed behaviour when searching index and no entry beginning with string is
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 17 Jan 2004 14:00:26 +0000 (14:00 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 17 Jan 2004 14:00:26 +0000 (14:00 +0000)
found: until now, it found first substring, and now it find substring from
beginning of word (it has to have space before it)

git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@201 13eb9ef6-21d5-0310-b721-a9d68796d827

index_DBI_cache.pm

index eb143be..3422069 100644 (file)
@@ -161,7 +161,7 @@ sub fetch {
                } else {
                        # if no match is found when searching from beginning
                        # of word in index, try substring match anywhere
-                       $sql2 = "select ord from $field where upper(item) like '%'||upper(?)||'%'";
+                       $sql2 = "select ord from $field where upper(item) like '% '||upper(?)||'%'";
                        $sth = $self->{dbh}->prepare($sql2) || die "sql2: $sql2; ".$self->{dbh}->errstr();
                        $sth->execute($where) || die "sql2: $sql2; ".$self->{dbh}->errstr();
                        if (my $row = $sth->fetchrow_hashref) {