MediaWiki  1.30.0
SearchIndexFieldDefinition Class Reference

Basic infrastructure of the field definition. More...

Inheritance diagram for SearchIndexFieldDefinition:
Collaboration diagram for SearchIndexFieldDefinition:

Public Member Functions

 __construct ( $name, $type)
 
 checkFlag ( $flag)
 Check if flag is set. More...
 
 getEngineHints (SearchEngine $engine)
 @inheritDoc More...
 
 getIndexType ()
 Get index type. More...
 
 getMapping (SearchEngine $engine)
 
 getName ()
 Get field name. More...
 
 getSubfields ()
 Get subfields. More...
 
 merge (SearchIndexField $that)
 Merge two field definitions if possible. More...
 
 setFlag ( $flag, $unset=false)
 Set global flag for this field. More...
 
 setMergeCallback ( $callback)
 Set field-specific merge strategy. More...
 
 setSubfields (array $subfields)
 Set subfields. More...
 

Protected Attributes

int $flags = 0
 Bit flags for the field. More...
 
string $name
 Name of the field. More...
 
SearchIndexFieldDefinition[] $subfields = []
 Subfields. More...
 
int $type
 Type of the field, one of the constants above. More...
 

Private Attributes

callable $mergeCallback
 

Additional Inherited Members

- Public Attributes inherited from SearchIndexField
const FLAG_CASEFOLD = 1
 Generic field flags. More...
 
const FLAG_NO_HIGHLIGHT = 4
 This field does not need highlight handling. More...
 
const FLAG_NO_INDEX = 8
 Do not index this field, just store it. More...
 
const FLAG_SCORING = 2
 This field contains secondary information, which is already present in other fields, but can be used for scoring. More...
 
const INDEX_TYPE_BOOL = 6
 
const INDEX_TYPE_DATETIME = 4
 
const INDEX_TYPE_INTEGER = 2
 
const INDEX_TYPE_KEYWORD = 1
 
const INDEX_TYPE_NESTED = 5
 
const INDEX_TYPE_NUMBER = 3
 
const INDEX_TYPE_SHORT_TEXT = 7
 SHORT_TEXT is meant to be used with short text made of mostly ascii technical information. More...
 
const INDEX_TYPE_TEXT = 0
 Field types. More...
 

Detailed Description

Basic infrastructure of the field definition.

Specific engines should extend this class and at at least, override the getMapping method, but can reuse other parts.

Since
1.28

Definition at line 11 of file SearchIndexFieldDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

SearchIndexFieldDefinition::__construct (   $name,
  $type 
)
Parameters
string$nameField name
int$typeIndex type

Definition at line 49 of file SearchIndexFieldDefinition.php.

References $name, $type, name, and type.

Member Function Documentation

◆ checkFlag()

SearchIndexFieldDefinition::checkFlag (   $flag)

Check if flag is set.

Parameters
int$flag
Returns
int 0 if unset, !=0 if set

Implements SearchIndexField.

Definition at line 91 of file SearchIndexFieldDefinition.php.

References flags.

◆ getEngineHints()

SearchIndexFieldDefinition::getEngineHints ( SearchEngine  $engine)

@inheritDoc

Implements SearchIndexField.

Definition at line 150 of file SearchIndexFieldDefinition.php.

◆ getIndexType()

SearchIndexFieldDefinition::getIndexType ( )

Get index type.

Returns
int

Definition at line 66 of file SearchIndexFieldDefinition.php.

References $type.

◆ getMapping()

SearchIndexFieldDefinition::getMapping ( SearchEngine  $engine)
abstract
Parameters
SearchEngine$engine
Returns
array

Implements SearchIndexField.

Reimplemented in DummySearchIndexFieldDefinition.

◆ getName()

SearchIndexFieldDefinition::getName ( )

Get field name.

Returns
string

Definition at line 58 of file SearchIndexFieldDefinition.php.

References $name.

◆ getSubfields()

SearchIndexFieldDefinition::getSubfields ( )

Get subfields.

Returns
SearchIndexFieldDefinition[]

Definition at line 118 of file SearchIndexFieldDefinition.php.

References $subfields.

◆ merge()

SearchIndexFieldDefinition::merge ( SearchIndexField  $that)

Merge two field definitions if possible.

Parameters
SearchIndexField$that
Returns
SearchIndexField|false New definition or false if not mergeable.

Implements SearchIndexField.

Definition at line 101 of file SearchIndexFieldDefinition.php.

References type.

◆ setFlag()

SearchIndexFieldDefinition::setFlag (   $flag,
  $unset = false 
)

Set global flag for this field.

Parameters
int$flagBit flag to set/unset
bool$unsetTrue if flag should be unset, false by default
Returns
$this

Implements SearchIndexField.

Definition at line 77 of file SearchIndexFieldDefinition.php.

References flags.

◆ setMergeCallback()

SearchIndexFieldDefinition::setMergeCallback (   $callback)

Set field-specific merge strategy.

Parameters
callable$callback

Definition at line 143 of file SearchIndexFieldDefinition.php.

◆ setSubfields()

SearchIndexFieldDefinition::setSubfields ( array  $subfields)

Set subfields.

Parameters
SearchIndexFieldDefinition[]$subfields
Returns
$this

Definition at line 127 of file SearchIndexFieldDefinition.php.

References $subfields.

Member Data Documentation

◆ $flags

int SearchIndexFieldDefinition::$flags = 0
protected

Bit flags for the field.

Definition at line 32 of file SearchIndexFieldDefinition.php.

Referenced by DummySearchIndexFieldDefinition\getMapping().

◆ $mergeCallback

callable SearchIndexFieldDefinition::$mergeCallback
private

Definition at line 43 of file SearchIndexFieldDefinition.php.

◆ $name

string SearchIndexFieldDefinition::$name
protected

Name of the field.

Definition at line 18 of file SearchIndexFieldDefinition.php.

Referenced by __construct(), DummySearchIndexFieldDefinition\getMapping(), and getName().

◆ $subfields

SearchIndexFieldDefinition [] SearchIndexFieldDefinition::$subfields = []
protected

Subfields.

Definition at line 38 of file SearchIndexFieldDefinition.php.

Referenced by getSubfields(), and setSubfields().

◆ $type

int SearchIndexFieldDefinition::$type
protected

Type of the field, one of the constants above.

Definition at line 25 of file SearchIndexFieldDefinition.php.

Referenced by __construct(), getIndexType(), and DummySearchIndexFieldDefinition\getMapping().


The documentation for this class was generated from the following file: