Merge "Enable recursive partials in TemplateParser"
[lhc/web/wiklou.git] / includes / search / SearchEngine.php
index 7d05265..3c8fe60 100644 (file)
@@ -60,6 +60,12 @@ abstract class SearchEngine {
        /** @const string profile type for query independent ranking features */
        const FT_QUERY_INDEP_PROFILE_TYPE = 'fulltextQueryIndepProfile';
 
+       /** @const int flag for legalSearchChars: includes all chars allowed in a search query */
+       const CHARS_ALL = 1;
+
+       /** @const int flag for legalSearchChars: includes all chars allowed in a search term */
+       const CHARS_NO_SYNTAX = 2;
+
        /**
         * Perform a full text search query and return a result set.
         * If full text searches are not supported or disabled, return null.
@@ -132,7 +138,7 @@ abstract class SearchEngine {
         * @return mixed the feature value or null if unset
         */
        public function getFeatureData( $feature ) {
-               if ( isset ( $this->features[$feature] ) ) {
+               if ( isset( $this->features[$feature] ) ) {
                        return $this->features[$feature];
                }
                return null;
@@ -206,24 +212,16 @@ abstract class SearchEngine {
        }
 
        /**
-        * Get chars legal for search (at query time).
+        * Get chars legal for search
         * NOTE: usage as static is deprecated and preserved only as BC measure
+        * @param int $type type of search chars (see self::CHARS_ALL
+        * and self::CHARS_NO_SYNTAX). Defaults to CHARS_ALL
         * @return string
         */
-       public static function legalSearchChars() {
+       public static function legalSearchChars( $type = self::CHARS_ALL ) {
                return "A-Za-z_'.0-9\\x80-\\xFF\\-";
        }
 
-       /**
-        * Get chars legal for search (at index time).
-        *
-        * @since 1.30
-        * @return string
-        */
-       public function legalSearchCharsForUpdate() {
-               return static::legalSearchChars();
-       }
-
        /**
         * Set the maximum number of results to return
         * and how many to skip before returning the first.
@@ -271,7 +269,7 @@ abstract class SearchEngine {
         * might support more. The default in all implementations should be 'relevance.'
         *
         * @since 1.25
-        * @return array(string) the valid sort directions for setSort
+        * @return string[] the valid sort directions for setSort
         */
        public function getValidSorts() {
                return [ 'relevance' ];
@@ -568,6 +566,7 @@ abstract class SearchEngine {
        /**
         * Process completion search results.
         * Resolves the titles and rescores.
+        * @param string $search
         * @param SearchSuggestionSet $suggestions
         * @return SearchSuggestionSet
         */
@@ -729,7 +728,7 @@ abstract class SearchEngine {
         * Create a search field definition.
         * Specific search engines should override this method to create search fields.
         * @param string $name
-        * @param int    $type One of the types in SearchIndexField::INDEX_TYPE_*
+        * @param int $type One of the types in SearchIndexField::INDEX_TYPE_*
         * @return SearchIndexField
         * @since 1.28
         */