mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
add populate controller in thesaurus
This commit is contained in:
@@ -13,6 +13,9 @@ use Alchemy\Phrasea\Application\Helper\DispatcherAware;
|
|||||||
use Alchemy\Phrasea\Controller\Controller;
|
use Alchemy\Phrasea\Controller\Controller;
|
||||||
use Alchemy\Phrasea\Core\Event\Thesaurus as ThesaurusEvent;
|
use Alchemy\Phrasea\Core\Event\Thesaurus as ThesaurusEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Thesaurus\ThesaurusEvents;
|
use Alchemy\Phrasea\Core\Event\Thesaurus\ThesaurusEvents;
|
||||||
|
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
|
||||||
|
use Alchemy\Phrasea\WorkerManager\Event\PopulateIndexEvent;
|
||||||
|
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
|
||||||
use Doctrine\DBAL\Driver\Connection;
|
use Doctrine\DBAL\Driver\Connection;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -1222,6 +1225,26 @@ class ThesaurusController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order to populate databox
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Symfony\Component\HttpFoundation\JsonResponse
|
||||||
|
*/
|
||||||
|
public function populate(Request $request)
|
||||||
|
{
|
||||||
|
$options = $this->getElasticsearchOptions();
|
||||||
|
|
||||||
|
$data['host'] = $options->getHost();
|
||||||
|
$data['port'] = $options->getPort();
|
||||||
|
$data['indexName'] = $options->getIndexName();
|
||||||
|
$data['databoxIds'] = [$request->get('databox_id')];
|
||||||
|
|
||||||
|
$this->getDispatcher()->dispatch(WorkerEvents::POPULATE_INDEX, new PopulateIndexEvent($data));
|
||||||
|
|
||||||
|
return $this->app->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Response
|
* @return Response
|
||||||
@@ -3031,4 +3054,12 @@ class ThesaurusController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->app['locales.available'];
|
return $this->app['locales.available'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ElasticsearchOptions
|
||||||
|
*/
|
||||||
|
private function getElasticsearchOptions()
|
||||||
|
{
|
||||||
|
return $this->app['elasticsearch.options'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class Thesaurus implements ControllerProviderInterface, ServiceProviderInterface
|
|||||||
$controllers->match('newterm.php', 'controller.thesaurus:newTerm');
|
$controllers->match('newterm.php', 'controller.thesaurus:newTerm');
|
||||||
$controllers->match('properties.php', 'controller.thesaurus:properties');
|
$controllers->match('properties.php', 'controller.thesaurus:properties');
|
||||||
$controllers->match('thesaurus.php', 'controller.thesaurus:thesaurus')->bind('thesaurus_thesaurus');
|
$controllers->match('thesaurus.php', 'controller.thesaurus:thesaurus')->bind('thesaurus_thesaurus');
|
||||||
|
$controllers->match('populate', 'controller.thesaurus:populate')->bind('thesaurus_populate');
|
||||||
|
|
||||||
$controllers->match('xmlhttp/accept.x.php', 'controller.thesaurus:acceptXml');
|
$controllers->match('xmlhttp/accept.x.php', 'controller.thesaurus:acceptXml');
|
||||||
$controllers->match('xmlhttp/acceptcandidates.x.php', 'controller.thesaurus:acceptCandidatesXml');
|
$controllers->match('xmlhttp/acceptcandidates.x.php', 'controller.thesaurus:acceptCandidatesXml');
|
||||||
|
|||||||
Reference in New Issue
Block a user