Reset searchTerms[] before populating.
authorChad Horohoe <chadh@wikimedia.org>
Fri, 5 Sep 2014 13:51:27 +0000 (06:51 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Fri, 5 Sep 2014 13:51:27 +0000 (06:51 -0700)
Otherwise, multiple calls to searchQuery() would accumulate search
terms. searchTerms[] is defined in SearchEngine so we can't just get
rid of it altogether.

Change-Id: Iddbb3920e3a9d5849c99fe90d2d725d16019b51d

includes/search/SearchPostgres.php

index 914bc1c..c64c845 100644 (file)
@@ -142,6 +142,7 @@ class SearchPostgres extends SearchDatabase {
                $top = $res->fetchRow();
                $top = $top[0];
 
+               $this->searchTerms = array();
                if ( $top === "" ) { ## e.g. if only stopwords are used XXX return something better
                        $query = "SELECT page_id, page_namespace, page_title, 0 AS score " .
                                "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .