Merge "Less false positives for MEDIATYPE_VIDEO"
[lhc/web/wiklou.git] / includes / search / SearchSqlite.php
index 1ac4946..8e820f3 100644 (file)
@@ -42,7 +42,7 @@ class SearchSqlite extends SearchDatabase {
         */
        function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
-               $lc = SearchEngine::legalSearchChars(); // Minus format chars
+               $lc = $this->legalSearchChars(); // Minus format chars
                $searchon = '';
                $this->searchTerms = array();
 
@@ -50,7 +50,9 @@ class SearchSqlite extends SearchDatabase {
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach ( $m as $bits ) {
-                               @list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
+                               wfSuppressWarnings();
+                               list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
+                               wfRestoreWarnings();
 
                                if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
@@ -113,9 +115,9 @@ class SearchSqlite extends SearchDatabase {
                        wfDebug( __METHOD__ . ": Can't understand search query '{$filteredText}'\n" );
                }
 
-               $searchon = $this->db->strencode( $searchon );
+               $searchon = $this->db->addQuotes( $searchon );
                $field = $this->getIndexField( $fulltext );
-               return " $field MATCH '$searchon' ";
+               return " $field MATCH $searchon ";
        }
 
        function regexTerm( $string, $wildcard ) {