Merge "Special:Upload should not crash on failing previews"
[mediawiki.git] / includes / search / SearchIndexField.php
blob6b5316f009fa2592998b56bdd0568c27cacf30ff
1 <?php
2 /**
3 * Definition of a mapping for the search index field.
4 * @since 1.28
5 */
6 interface SearchIndexField {
7 /**
8 * Field types
9 */
10 const INDEX_TYPE_TEXT = 0;
11 const INDEX_TYPE_KEYWORD = 1;
12 const INDEX_TYPE_INTEGER = 2;
13 const INDEX_TYPE_NUMBER = 3;
14 const INDEX_TYPE_DATETIME = 4;
15 const INDEX_TYPE_NESTED = 5;
16 const INDEX_TYPE_BOOL = 6;
18 /**
19 * SHORT_TEXT is meant to be used with short text made of mostly ascii
20 * technical information. Generally a language agnostic analysis chain
21 * is used and aggressive splitting to increase recall.
22 * E.g suited for mime/type
24 const INDEX_TYPE_SHORT_TEXT = 7;
26 /**
27 * Generic field flags.
29 /**
30 * This field is case-insensitive.
32 const FLAG_CASEFOLD = 1;
33 /**
34 * This field contains secondary information, which is
35 * already present in other fields, but can be used for
36 * scoring.
38 const FLAG_SCORING = 2;
39 /**
40 * This field does not need highlight handling.
42 const FLAG_NO_HIGHLIGHT = 4;
43 /**
44 * Do not index this field, just store it.
46 const FLAG_NO_INDEX = 8;
48 /**
49 * Get mapping for specific search engine
50 * @param SearchEngine $engine
51 * @return array|null Null means this field does not map to anything
53 public function getMapping( SearchEngine $engine );
54 /**
55 * Set global flag for this field.
57 * @param int $flag Bit flag to set/unset
58 * @param bool $unset True if flag should be unset, false by default
59 * @return $this
61 public function setFlag( $flag, $unset = false );
62 /**
63 * Check if flag is set.
64 * @param $flag
65 * @return int 0 if unset, !=0 if set
67 public function checkFlag( $flag );
68 /**
69 * Merge two field definitions if possible.
71 * @param SearchIndexField $that
72 * @return SearchIndexField|false New definition or false if not mergeable.
74 public function merge( SearchIndexField $that );