diff --git a/lib/Alchemy/Phrasea/Command/Thesaurus/FindConceptsCommand.php b/lib/Alchemy/Phrasea/Command/Thesaurus/FindConceptsCommand.php
index 269f6700dd..45fa006ccf 100644
--- a/lib/Alchemy/Phrasea/Command/Thesaurus/FindConceptsCommand.php
+++ b/lib/Alchemy/Phrasea/Command/Thesaurus/FindConceptsCommand.php
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Command\Thesaurus;
use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer;
+use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus\Term;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -30,6 +31,11 @@ class FindConceptsCommand extends Command
InputArgument::REQUIRED,
'Reverse search a term to infer concepts'
)
+ ->addArgument(
+ 'context',
+ InputArgument::OPTIONAL,
+ 'Restrict search to a specific term context'
+ )
->addOption(
'locale',
null,
@@ -48,16 +54,22 @@ class FindConceptsCommand extends Command
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$term = $input->getArgument('term');
+ $context = $input->getArgument('context');
$raw = $input->getOption('raw');
if (!$raw) {
- $output->writeln(sprintf('Finding linked concepts: %s', $term));
+ $message = sprintf('Finding linked concepts: %s', $term);
+ if ($context) {
+ $message .= sprintf(' (with context %s)', $context);
+ }
+ $output->writeln($message);
$output->writeln(str_repeat('-', 20));
}
$thesaurus = $this->container['thesaurus'];
+ $term = new Term($term, $context);
$locale = $input->getOption('locale');
- $concepts = $thesaurus->findConcepts($term, null, $locale);
+ $concepts = $thesaurus->findConcepts($term, $locale);
if (count($concepts)) {
$output->writeln($concepts);