summaryrefslogtreecommitdiff
path: root/includes/SearchPostgres.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SearchPostgres.php')
-rw-r--r--includes/SearchPostgres.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php
index 88e4a0da..4862a44e 100644
--- a/includes/SearchPostgres.php
+++ b/includes/SearchPostgres.php
@@ -66,6 +66,7 @@ class SearchPostgres extends SearchEngine {
/*
* Transform the user's search string into a better form for tsearch2
+ * Returns an SQL fragment consisting of quoted text to search for.
*/
function parseQuery( $term ) {
@@ -142,6 +143,7 @@ class SearchPostgres extends SearchEngine {
}
$prefix = $wgDBversion < 8.3 ? "'default'," : '';
+ # Get the SQL fragment for the given term
$searchstring = $this->parseQuery( $term );
## We need a separate query here so gin does not complain about empty searches
@@ -183,7 +185,7 @@ class SearchPostgres extends SearchEngine {
if ( count($this->namespaces) < 1)
$query .= ' AND page_namespace = 0';
else {
- $namespaces = implode( ',', $this->namespaces );
+ $namespaces = $this->db->makeList( $this->namespaces );
$query .= " AND page_namespace IN ($namespaces)";
}
}
@@ -201,9 +203,9 @@ class SearchPostgres extends SearchEngine {
function update( $pageid, $title, $text ) {
## We don't want to index older revisions
- $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id = ".
- "(SELECT rev_text_id FROM revision WHERE rev_page = $pageid ".
- "ORDER BY rev_text_id DESC LIMIT 1 OFFSET 1)";
+ $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN ".
+ "(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) .
+ " ORDER BY rev_text_id DESC OFFSET 1)";
$this->db->doQuery($SQL);
return true;
}