Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
NestedIndexField | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
addSubfield | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMapping | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace CirrusSearch\Search; |
4 | |
5 | use SearchEngine; |
6 | use SearchIndexField; |
7 | |
8 | class NestedIndexField extends CirrusIndexField { |
9 | /** @inheritDoc */ |
10 | protected $typeName = "nested"; |
11 | |
12 | /** |
13 | * Add sub-field for nested field |
14 | * @param string $name Field name |
15 | * @param SearchIndexField $subfield Field object |
16 | */ |
17 | public function addSubfield( $name, SearchIndexField $subfield ) { |
18 | $this->subfields[$name] = $subfield; |
19 | } |
20 | |
21 | /** @inheritDoc */ |
22 | public function getMapping( SearchEngine $engine ) { |
23 | $fields = parent::getMapping( $engine ); |
24 | foreach ( $this->subfields as $name => $sub ) { |
25 | $fields['properties'][$name] = $sub->getMapping( $engine ); |
26 | } |
27 | return $fields; |
28 | } |
29 | } |