Search is working. But it is case sensitive
This commit is contained in:
parent
1235bfe0de
commit
e7c0716a67
12
II/DB.pm
12
II/DB.pm
@ -2,7 +2,6 @@ package II::DB;
|
|||||||
|
|
||||||
use SQL::Abstract;
|
use SQL::Abstract;
|
||||||
use DBI;
|
use DBI;
|
||||||
use Encode;
|
|
||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
@ -340,13 +339,12 @@ sub do_search {
|
|||||||
my ( $self, $query ) = @_;
|
my ( $self, $query ) = @_;
|
||||||
my $dbh = $self->{_dbh};
|
my $dbh = $self->{_dbh};
|
||||||
|
|
||||||
# $query = $query;
|
my $q = "select from_user, to_user, subg, time, echo, post, hash
|
||||||
|
from messages where subg
|
||||||
print "QUERY " . $query . "\n";
|
like '\%$query\%' COLLATE NOCASE
|
||||||
|
order by time";
|
||||||
my $q
|
|
||||||
= "select from_user, to_user, subg, time, echo, post, hash from messages where subg like '\%$query\%' order by time";
|
|
||||||
|
|
||||||
|
print "SQL: " . $q . "\n";
|
||||||
my $sth = $dbh->prepare($q);
|
my $sth = $dbh->prepare($q);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
|
||||||
|
@ -186,7 +186,9 @@ my $search = sub {
|
|||||||
my $query = $req->param('q');
|
my $query = $req->param('q');
|
||||||
|
|
||||||
my $db = II::DB->new();
|
my $db = II::DB->new();
|
||||||
my $result = $db->do_search($q);
|
my @post = $db->do_search($query);
|
||||||
|
|
||||||
|
my $result = $render->search(@post);
|
||||||
|
|
||||||
return [ 200, [ 'Content-type' => 'text/html' ], [$result], ];
|
return [ 200, [ 'Content-type' => 'text/html' ], [$result], ];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user