MediaWiki REL1_30
SearchIndexFieldDefinition.php
Go to the documentation of this file.
1<?php
2
12
18 protected $name;
19
25 protected $type;
26
32 protected $flags = 0;
33
38 protected $subfields = [];
39
44
49 public function __construct( $name, $type ) {
50 $this->name = $name;
51 $this->type = $type;
52 }
53
58 public function getName() {
59 return $this->name;
60 }
61
66 public function getIndexType() {
67 return $this->type;
68 }
69
77 public function setFlag( $flag, $unset = false ) {
78 if ( $unset ) {
79 $this->flags &= ~$flag;
80 } else {
81 $this->flags |= $flag;
82 }
83 return $this;
84 }
85
91 public function checkFlag( $flag ) {
92 return $this->flags & $flag;
93 }
94
101 public function merge( SearchIndexField $that ) {
102 if ( !empty( $this->mergeCallback ) ) {
103 return call_user_func( $this->mergeCallback, $this, $that );
104 }
105 // TODO: which definitions may be compatible?
106 if ( ( $that instanceof self ) && $this->type === $that->type &&
107 $this->flags === $that->flags && $this->type !== self::INDEX_TYPE_NESTED
108 ) {
109 return $that;
110 }
111 return false;
112 }
113
118 public function getSubfields() {
119 return $this->subfields;
120 }
121
127 public function setSubfields( array $subfields ) {
128 $this->subfields = $subfields;
129 return $this;
130 }
131
137 abstract public function getMapping( SearchEngine $engine );
138
143 public function setMergeCallback( $callback ) {
144 $this->mergeCallback = $callback;
145 }
146
151 return [];
152 }
153}
Contain a class for special pages.
Basic infrastructure of the field definition.
SearchIndexFieldDefinition[] $subfields
Subfields.
getEngineHints(SearchEngine $engine)
@inheritDoc
setMergeCallback( $callback)
Set field-specific merge strategy.
getMapping(SearchEngine $engine)
merge(SearchIndexField $that)
Merge two field definitions if possible.
setFlag( $flag, $unset=false)
Set global flag for this field.
setSubfields(array $subfields)
Set subfields.
int $flags
Bit flags for the field.
int $type
Type of the field, one of the constants above.
checkFlag( $flag)
Check if flag is set.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as flags
Definition design.txt:34
the value to return A Title object or null for latest all implement SearchIndexField $engine
Definition hooks.txt:2850
Definition of a mapping for the search index field.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition postgres.txt:36