* @since 1.28
*/
interface SearchIndexField {
- /**
+ /*
* Field types
*/
+ /**
+ * 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 = 0;
+ /**
+ * 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 = 1;
const INDEX_TYPE_INTEGER = 2;
const INDEX_TYPE_NUMBER = 3;
* 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.
*/
* @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.
*