Explicitly use 'default' locale for tsearch2 queries.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 3 Sep 2006 02:43:26 +0000 (02:43 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 3 Sep 2006 02:43:26 +0000 (02:43 +0000)
includes/SearchPostgres.php
maintenance/postgres/tables.sql

index 8d8ceea..faf53f0 100644 (file)
@@ -99,7 +99,7 @@ class SearchPostgres extends SearchEngine {
 
                $query = "SELECT page_id, page_namespace, page_title, old_text AS page_text ".
                        "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
-                       "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery('$match')";
+                       "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery('default','$match')";
 
                ## Redirects
                if (! $this->showRedirects)
@@ -113,7 +113,7 @@ class SearchPostgres extends SearchEngine {
                        $query .=  " AND page_namespace IN ($namespaces)";
                }
 
-               $query .= " ORDER BY rank($fulltext, to_tsquery('$fulltext')) DESC";
+               $query .= " ORDER BY rank($fulltext, to_tsquery('default','$fulltext')) DESC";
 
                $query .= $this->db->limitResult( '', $this->limit, $this->offset );
 
index 46b428b..17f51e7 100644 (file)
@@ -406,9 +406,9 @@ CREATE FUNCTION ts2_page_title() RETURNS TRIGGER LANGUAGE plpgsql AS
 $mw$
 BEGIN
 IF TG_OP = 'INSERT' THEN
-  NEW.titlevector = to_tsvector(NEW.page_title);
+  NEW.titlevector = to_tsvector('default',NEW.page_title);
 ELSIF NEW.page_title != OLD.page_title THEN
-  NEW.titlevector := to_tsvector(NEW.page_title);
+  NEW.titlevector := to_tsvector('default',NEW.page_title);
 END IF;
 RETURN NEW;
 END;
@@ -424,9 +424,9 @@ CREATE FUNCTION ts2_page_text() RETURNS TRIGGER LANGUAGE plpgsql AS
 $mw$
 BEGIN
 IF TG_OP = 'INSERT' THEN
-  NEW.textvector = to_tsvector(NEW.old_text);
+  NEW.textvector = to_tsvector('default',NEW.old_text);
 ELSIF NEW.old_text != OLD.old_text THEN
-  NEW.textvector := to_tsvector(NEW.old_text);
+  NEW.textvector := to_tsvector('default',NEW.old_text);
 END IF;
 RETURN NEW;
 END;