Merge "Add SearchIndexField::getEngineHints()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 28 Jun 2017 20:37:13 +0000 (20:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 28 Jun 2017 20:37:13 +0000 (20:37 +0000)
includes/search/NullIndexField.php
includes/search/SearchIndexField.php
includes/search/SearchIndexFieldDefinition.php

index 933e0ad..852e1d5 100644 (file)
@@ -42,4 +42,11 @@ class NullIndexField implements SearchIndexField {
        public function merge( SearchIndexField $that ) {
                return $that;
        }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function getEngineHints( SearchEngine $engine ) {
+               return [];
+       }
 }
index 6b5316f..a348d6d 100644 (file)
@@ -72,4 +72,21 @@ interface SearchIndexField {
         * @return SearchIndexField|false New definition or false if not mergeable.
         */
        public function merge( SearchIndexField $that );
+
+       /**
+        * A list of search engine hints for this field.
+        * Hints are usually specific to a search engine implementation
+        * and allow to fine control how the search engine will handle this
+        * particular field.
+        *
+        * For example some search engine permits some optimizations
+        * at index time by ignoring an update if the updated value
+        * does not change by more than X% on a numeric value.
+        *
+        * @param SearchEngine $engine
+        * @return array an array of hints generally indexed by hint name. The type of
+        * values is search engine specific
+        * @since 1.30
+        */
+       public function getEngineHints( SearchEngine $engine );
 }
index 04344fd..e3e01e8 100644 (file)
@@ -140,4 +140,11 @@ abstract class SearchIndexFieldDefinition implements SearchIndexField {
        public function setMergeCallback( $callback ) {
                $this->mergeCallback = $callback;
        }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function getEngineHints( SearchEngine $engine ) {
+               return [];
+       }
 }