session: Add debug message for the used store class
[lhc/web/wiklou.git] / includes / search / SearchIndexField.php
index a348d6d..7bc4ba5 100644 (file)
@@ -4,16 +4,28 @@
  * @since 1.28
  */
 interface SearchIndexField {
-       /**
+       /*
         * Field types
         */
-       const INDEX_TYPE_TEXT = 0;
-       const INDEX_TYPE_KEYWORD = 1;
-       const INDEX_TYPE_INTEGER = 2;
-       const INDEX_TYPE_NUMBER = 3;
-       const INDEX_TYPE_DATETIME = 4;
-       const INDEX_TYPE_NESTED = 5;
-       const INDEX_TYPE_BOOL = 6;
+       /**
+        * TEXT fields are suitable for natural language and may be subject to
+        * analysis such as stemming.
+        *
+        * Read more:
+        * https://wikimediafoundation.org/2018/08/07/anatomy-search-token-affection/
+        * https://wikimediafoundation.org/2018/09/13/anatomy-search-variation-under-nature/
+        */
+       const INDEX_TYPE_TEXT = 'text';
+       /**
+        * KEYWORD fields are indexed without any processing, so are appropriate
+        * for e.g. URLs.  The content will often consist of a single token.
+        */
+       const INDEX_TYPE_KEYWORD = 'keyword';
+       const INDEX_TYPE_INTEGER = 'integer';
+       const INDEX_TYPE_NUMBER = 'number';
+       const INDEX_TYPE_DATETIME = 'datetime';
+       const INDEX_TYPE_NESTED = 'nested';
+       const INDEX_TYPE_BOOL = 'bool';
 
        /**
         * SHORT_TEXT is meant to be used with short text made of mostly ascii
@@ -21,7 +33,7 @@ interface SearchIndexField {
         * is used and aggressive splitting to increase recall.
         * E.g suited for mime/type
         */
-       const INDEX_TYPE_SHORT_TEXT = 7;
+       const INDEX_TYPE_SHORT_TEXT = 'short_text';
 
        /**
         * Generic field flags.
@@ -30,16 +42,19 @@ interface SearchIndexField {
         * This field is case-insensitive.
         */
        const FLAG_CASEFOLD = 1;
+
        /**
         * This field contains secondary information, which is
         * already present in other fields, but can be used for
         * scoring.
         */
        const FLAG_SCORING = 2;
+
        /**
         * This field does not need highlight handling.
         */
        const FLAG_NO_HIGHLIGHT = 4;
+
        /**
         * Do not index this field, just store it.
         */
@@ -51,20 +66,23 @@ interface SearchIndexField {
         * @return array|null Null means this field does not map to anything
         */
        public function getMapping( SearchEngine $engine );
+
        /**
         * Set global flag for this field.
         *
-        * @param int  $flag Bit flag to set/unset
+        * @param int $flag Bit flag to set/unset
         * @param bool $unset True if flag should be unset, false by default
         * @return $this
         */
        public function setFlag( $flag, $unset = false );
+
        /**
         * Check if flag is set.
-        * @param $flag
+        * @param int $flag
         * @return int 0 if unset, !=0 if set
         */
        public function checkFlag( $flag );
+
        /**
         * Merge two field definitions if possible.
         *