mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Rename GlobalElasticOptions ElasticsearchOptions
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Controller\Controller;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticSearchSettingFormType;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\GlobalElasticOptions;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchSettingsFormType;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -25,7 +25,7 @@ class SearchEngineController extends Controller
|
||||
*/
|
||||
public function formConfigurationPanelAction(Request $request)
|
||||
{
|
||||
$options = $this->getElasticSearchOptions();
|
||||
$options = $this->getElasticsearchOptions();
|
||||
$form = $this->getConfigurationForm($options);
|
||||
|
||||
$form->handleRequest($request);
|
||||
@@ -42,29 +42,29 @@ class SearchEngineController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return GlobalElasticOptions
|
||||
* @return ElasticsearchOptions
|
||||
*/
|
||||
private function getElasticSearchOptions()
|
||||
private function getElasticsearchOptions()
|
||||
{
|
||||
return $this->app['elasticsearch.options'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GlobalElasticOptions $configuration
|
||||
* @param ElasticsearchOptions $configuration
|
||||
* @return void
|
||||
*/
|
||||
private function saveElasticSearchOptions(GlobalElasticOptions $configuration)
|
||||
private function saveElasticSearchOptions(ElasticsearchOptions $configuration)
|
||||
{
|
||||
$this->getConf()->set(['main', 'search-engine', 'options'], $configuration->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GlobalElasticOptions $options
|
||||
* @param ElasticsearchOptions $options
|
||||
* @return FormInterface
|
||||
*/
|
||||
private function getConfigurationForm(GlobalElasticOptions $options)
|
||||
private function getConfigurationForm(ElasticsearchOptions $options)
|
||||
{
|
||||
return $this->app->form(new ElasticSearchSettingFormType(), $options, [
|
||||
return $this->app->form(new ElasticsearchSettingsFormType(), $options, [
|
||||
'action' => $this->app->url('admin_searchengine_form'),
|
||||
]);
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Core\Provider;
|
||||
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\GlobalElasticOptions;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineLogger;
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
||||
@@ -54,7 +54,7 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
||||
if ($type !== SearchEngineInterface::TYPE_ELASTICSEARCH) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid search engine type "%s".', $type));
|
||||
}
|
||||
/** @var GlobalElasticOptions $options */
|
||||
/** @var ElasticsearchOptions $options */
|
||||
$options = $app['elasticsearch.options'];
|
||||
|
||||
return new ElasticSearchEngine(
|
||||
@@ -136,7 +136,7 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
||||
/* Low-level elasticsearch services */
|
||||
|
||||
$app['elasticsearch.client'] = $app->share(function($app) {
|
||||
/** @var GlobalElasticOptions $options */
|
||||
/** @var ElasticsearchOptions $options */
|
||||
$options = $app['elasticsearch.options'];
|
||||
$clientParams = ['hosts' => [sprintf('%s:%s', $options->getHost(), $options->getPort())]];
|
||||
|
||||
@@ -154,7 +154,7 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
||||
});
|
||||
|
||||
$app['elasticsearch.options'] = $app->share(function($app) {
|
||||
$options = GlobalElasticOptions::fromArray($app['conf']->get(['main', 'search-engine', 'options'], []));
|
||||
$options = ElasticsearchOptions::fromArray($app['conf']->get(['main', 'search-engine', 'options'], []));
|
||||
|
||||
if (empty($options->getIndexName())) {
|
||||
$options->setIndexName(strtolower(sprintf('phraseanet_%s', str_replace(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
namespace Alchemy\Phrasea\SearchEngine\Elastic;
|
||||
|
||||
class GlobalElasticOptions
|
||||
class ElasticsearchOptions
|
||||
{
|
||||
/** @var string */
|
||||
private $host;
|
@@ -14,7 +14,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
|
||||
class ElasticSearchSettingFormType extends AbstractType
|
||||
class ElasticsearchSettingsFormType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@@ -48,6 +48,6 @@ class ElasticSearchSettingFormType extends AbstractType
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'elastic_settings';
|
||||
return 'elasticsearch_settings';
|
||||
}
|
||||
}
|
@@ -32,7 +32,7 @@ class Indexer
|
||||
|
||||
/** @var \Elasticsearch\Client */
|
||||
private $client;
|
||||
/** @var GlobalElasticOptions */
|
||||
/** @var ElasticsearchOptions */
|
||||
private $options;
|
||||
private $appbox;
|
||||
/** @var LoggerInterface|null */
|
||||
@@ -49,7 +49,7 @@ class Indexer
|
||||
const DEFAULT_REFRESH_INTERVAL = '1s';
|
||||
const REFRESH_INTERVAL_KEY = 'index.refresh_interval';
|
||||
|
||||
public function __construct(Client $client, GlobalElasticOptions $options, TermIndexer $termIndexer, RecordIndexer $recordIndexer, appbox $appbox, LoggerInterface $logger = null)
|
||||
public function __construct(Client $client, ElasticsearchOptions $options, TermIndexer $termIndexer, RecordIndexer $recordIndexer, appbox $appbox, LoggerInterface $logger = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->options = $options;
|
||||
|
@@ -24,12 +24,12 @@ class Thesaurus
|
||||
{
|
||||
/** @var Client */
|
||||
private $client;
|
||||
/** @var GlobalElasticOptions */
|
||||
/** @var ElasticsearchOptions */
|
||||
private $options;
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(Client $client, GlobalElasticOptions $options, LoggerInterface $logger)
|
||||
public function __construct(Client $client, ElasticsearchOptions $options, LoggerInterface $logger)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->options = $options;
|
||||
|
Reference in New Issue
Block a user