Added configuration options to support index-time document boosting

This commit is contained in:
predakanga 2012-08-09 13:49:04 +10:00
parent 67a11a59ce
commit 70c629f857
2 changed files with 22 additions and 0 deletions

View file

@ -214,6 +214,7 @@ class Configuration
->end()
->append($this->getMappingsNode())
->append($this->getSourceNode())
->append($this->getBoostNode())
->end()
;
@ -295,4 +296,22 @@ class Configuration
return $node;
}
/**
* Returns the array node used for "_boost".
*/
protected function getBoostNode()
{
$builder = new TreeBuilder();
$node = $builder->root('_boost');
$node
->children()
->scalarNode('name')->end()
->scalarNode('null_value')->end()
->end()
;
return $node;
}
}

View file

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