added automated wildcards to search engine, to make it act more like people would expect
This commit is contained in:
parent
bf1a0ad11e
commit
78b97985ab
2 changed files with 10 additions and 2 deletions
|
|
@ -262,7 +262,15 @@ sub search {
|
|||
my $query = "";
|
||||
my @clauses = ();
|
||||
if ($rules->{keywords}) {
|
||||
push(@params,$rules->{keywords},$rules->{keywords});
|
||||
my $keywords = $rules->{keywords};
|
||||
unless ($keywords =~ m/"|\*/) { # do wildcards for people, like they'd expect
|
||||
my @terms = split(' ',$keywords);
|
||||
for (my $i = 0; $i < scalar(@terms); $i++) {
|
||||
$terms[$i] .= "*";
|
||||
}
|
||||
$keywords = join(" ", @terms);
|
||||
}
|
||||
push(@params, $keywords, $keywords);
|
||||
$self->{_score} = "match (keywords) against (? in boolean mode) as score";
|
||||
push(@clauses, "match (keywords) against (? in boolean mode)");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ sub reindexSite {
|
|||
my $rs = $session->db->read("select assetId, className from asset where state='published'");
|
||||
while (my ($id, $class) = $rs->array) {
|
||||
my $asset = WebGUI::Asset->new($session,$id,$class);
|
||||
if (defined $asset && $asset->get("status") eq "approved" || $asset->get("status") eq "archived") {
|
||||
if (defined $asset && $asset->get("status") eq "approved" || defined $asset && $asset->get("status") eq "archived") {
|
||||
print $asset->getId."\t".$asset->getTitle."\t";
|
||||
my $t = [Time::HiRes::gettimeofday()];
|
||||
$asset->indexContent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue