Merge pull request #203 from micjohnson/patch-3

Adding _routing to type configuration
This commit is contained in:
Richard Miller 2013-02-03 11:44:51 -08:00
commit bfb0f823c1
2 changed files with 22 additions and 0 deletions

View file

@ -248,6 +248,7 @@ class Configuration
->append($this->getMappingsNode())
->append($this->getSourceNode())
->append($this->getBoostNode())
->append($this->getRoutingNode())
->end()
;
@ -374,4 +375,22 @@ class Configuration
return $node;
}
/**
* Returns the array node used for "_routing".
*/
protected function getRoutingNode()
{
$builder = new TreeBuilder();
$node = $builder->root('_routing');
$node
->children()
->scalarNode('required')->end()
->scalarNode('path')->end()
->end()
;
return $node;
}
}

View file

@ -174,6 +174,9 @@ class FOQElasticaExtension extends Extension
if (isset($type['_boost'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_boost'] = $type['_boost'];
}
if (isset($type['_routing'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_routing'] = $type['_routing'];
}
if (isset($type['mappings'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['properties'] = $type['mappings'];
$typeName = sprintf('%s/%s', $indexName, $name);