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 | protected $typeName = "nested"; |
10 | |
11 | /** |
12 | * Add sub-field for nested field |
13 | * @param string $name Field name |
14 | * @param SearchIndexField $subfield Field object |
15 | */ |
16 | public function addSubfield( $name, SearchIndexField $subfield ) { |
17 | $this->subfields[$name] = $subfield; |
18 | } |
19 | |
20 | public function getMapping( SearchEngine $engine ) { |
21 | $fields = parent::getMapping( $engine ); |
22 | foreach ( $this->subfields as $name => $sub ) { |
23 | $fields['properties'][$name] = $sub->getMapping( $engine ); |
24 | } |
25 | return $fields; |
26 | } |
27 | } |