Bug 70605
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1332 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
c33d2f79ab
commit
29d595dcdd
|
@ -187,16 +187,16 @@ sub sql_fulltext_search
|
|||
{
|
||||
my $self = shift;
|
||||
my ($column, $text) = @_;
|
||||
my $language = Bugzilla->localconfig->{postgres_fulltext_language};
|
||||
my $language = Bugzilla->localconfig->{postgres_fulltext_language} || 'english';
|
||||
$language = $self->quote($language).',';
|
||||
$text = $self->quote($text);
|
||||
# Try to_tsquery, and use plainto_tsquery if the syntax is incorrect
|
||||
# FIXME reporting errors to user would be useful here
|
||||
eval { $self->do("SELECT to_tsquery($text)") };
|
||||
eval { $self->do("SELECT to_tsquery($language$text)") };
|
||||
my $op = $@ ? 'plainto_tsquery' : 'to_tsquery';
|
||||
return (
|
||||
"(to_tsvector($language$column) \@\@ $op($text))",
|
||||
"(ts_rank(to_tsvector($language$column), $op($text)))",
|
||||
"(to_tsvector($language$column) \@\@ $op($language$text))",
|
||||
"(ts_rank(to_tsvector($language$column), $op($language$text)))",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ sub _get_create_index_ddl
|
|||
if ($index_type && $index_type eq 'FULLTEXT')
|
||||
{
|
||||
$index_fields = @$index_fields > 1 ? join(" || ' ' || ", @$index_fields) : $index_fields->[0];
|
||||
my $language = Bugzilla->localconfig->{postgres_fulltext_language};
|
||||
my $language = Bugzilla->localconfig->{postgres_fulltext_language} || 'english';
|
||||
return "CREATE INDEX $name ON $table USING gin(to_tsvector('$language', $index_fields))";
|
||||
}
|
||||
return $self->SUPER::_get_create_index_ddl(@_);
|
||||
|
|
Loading…
Reference in New Issue