Merge pull request #151 from geecu/fix_search_command
fix search command when no index option is passed
This commit is contained in:
commit
20a58c502c
|
@ -40,7 +40,8 @@ class SearchCommand extends ContainerAwareCommand
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$index = $this->getContainer()->get('foq_elastica.index_manager')->getIndex($input->getOption('index'));
|
||||
$indexName = $input->getOption('index');
|
||||
$index = $this->getContainer()->get('foq_elastica.index_manager')->getIndex($indexName ? $indexName : null);
|
||||
$type = $index->getType($input->getArgument('type'));
|
||||
$query = Elastica_Query::create($input->getArgument('query'));
|
||||
$query->setLimit($input->getOption('limit'));
|
||||
|
|
|
@ -13,10 +13,10 @@ class IndexManager
|
|||
* @param array $indexesByName
|
||||
* @param string $defaultIndexName
|
||||
*/
|
||||
public function __construct(array $indexesByName, $defaultIndexName)
|
||||
public function __construct(array $indexesByName, $defaultIndex)
|
||||
{
|
||||
$this->indexesByName = $indexesByName;
|
||||
$this->defaultIndexName = $defaultIndexName;
|
||||
$this->defaultIndexName = $defaultIndex->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue