added index_analyzer and search_analyzer type options

This commit is contained in:
Miguel Ibero 2012-05-17 13:00:53 +02:00
parent 836481aff7
commit ae80e3e4f3
2 changed files with 9 additions and 1 deletions

View file

@ -77,6 +77,8 @@ class Configuration
->end()
->arrayNode('type_prototype')
->children()
->scalarNode('index_analyzer')->end()
->scalarNode('search_analyzer')->end()
->arrayNode('persistence')
->validate()
->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); })
@ -153,6 +155,8 @@ class Configuration
->prototype('array')
->treatNullLike(array())
->children()
->scalarNode('index_analyzer')->end()
->scalarNode('search_analyzer')->end()
->arrayNode('persistence')
->validate()
->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); })

View file

@ -168,16 +168,20 @@ class FOQElasticaExtension extends Extension
$typeDef->setFactoryMethod('getType');
$container->setDefinition($typeId, $typeDef);
if (isset($type['_source'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_source'] = $type['_source'];
}
if (isset($type['mappings'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['properties'] = $type['mappings'];
$typeName = sprintf('%s/%s', $indexName, $name);
$this->typeFields[$typeName] = array_keys($type['mappings']);
unset($type['mappings']);
}
if (isset($type['persistence'])) {
$this->loadTypePersistenceIntegration($type['persistence'], $container, $typeDef, $indexName, $name);
unset($type['persistence']);
}
$this->indexConfigs[$indexName]['config']['mappings'][$name] = array_merge(
$this->indexConfigs[$indexName]['config']['mappings'][$name], $type);
}
}