Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 6
NestedIndexField
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 6
 addSubfield
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getMapping
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 4
<?php
namespace CirrusSearch\Search;
use SearchEngine;
use SearchIndexField;
class NestedIndexField extends CirrusIndexField {
    protected $typeName = "nested";
    /**
     * Add sub-field for nested field
     * @param string $name Field name
     * @param SearchIndexField $subfield Field object
     */
    public function addSubfield( $name, SearchIndexField $subfield ) {
        $this->subfields[$name] = $subfield;
    }
    public function getMapping( SearchEngine $engine ) {
        $fields = parent::getMapping( $engine );
        foreach ( $this->subfields as $name => $sub ) {
            $fields['properties'][$name] = $sub->getMapping( $engine );
        }
        return $fields;
    }
}