* Correct case for formatNum
[lhc/web/wiklou.git] / includes / SearchEngine.php
index 66e8d9b..cd8f804 100644 (file)
@@ -13,6 +13,7 @@
 class SearchEngine {
        var $limit = 10;
        var $offset = 0;
+       var $prefix = '';
        var $searchTerms = array();
        var $namespaces = array( NS_MAIN );
        var $showRedirects = false;
@@ -48,6 +49,14 @@ class SearchEngine {
                return true;
        }
        
+       /**
+        * Transform search term in cases when parts of the query came as different GET params (when supported)
+        * e.g. for prefix queries: search=test&prefix=Main_Page/Archive -> test prefix:Main Page/Archive
+        */
+       function transformSearchTerm( $term ) {
+               return $term;
+       }
+       
        /**
         * If an exact title match can be find, or a very slightly close match,
         * return the title. If no match, returns NULL.
@@ -150,7 +159,7 @@ class SearchEngine {
        }
 
        public static function legalSearchChars() {
-               return "A-Za-z_'0-9\\x80-\\xFF\\-";
+               return "A-Za-z_'.0-9\\x80-\\xFF\\-";
        }
 
        /**
@@ -394,7 +403,7 @@ class SearchEngine {
                if($wgMWSuggestTemplate)                
                        return $wgMWSuggestTemplate;
                else 
-                       return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}';
+                       return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest';
        }
 }
 
@@ -461,7 +470,7 @@ class SearchResultSet {
        }
 
        /**
-        * @return string highlighted suggested query, '' if none
+        * @return string HTML highlighted suggested query, '' if none
         */
        function getSuggestionSnippet(){
                return '';
@@ -1156,12 +1165,12 @@ class SearchHighlighter {
                 continue;
             }
             --$contextlines;
-            $pre = $wgContLang->truncate( $m[1], -$contextchars, ' ... ' );
+            $pre = $wgContLang->truncate( $m[1], -$contextchars );
 
             if ( count( $m ) < 3 ) {
                 $post = '';
             } else {
-                $post = $wgContLang->truncate( $m[3], $contextchars, ' ... ' );
+                $post = $wgContLang->truncate( $m[3], $contextchars );
             }
 
             $found = $m[2];