diff --git a/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php b/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php index c98a66cb26..a252f3f3fb 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php @@ -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'), ]); } diff --git a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php index e08df3188a..887aea1a4d 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php @@ -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( diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/GlobalElasticOptions.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchOptions.php similarity index 99% rename from lib/Alchemy/Phrasea/SearchEngine/Elastic/GlobalElasticOptions.php rename to lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchOptions.php index e8a6a486da..3f76c50f34 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/GlobalElasticOptions.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchOptions.php @@ -9,7 +9,7 @@ */ namespace Alchemy\Phrasea\SearchEngine\Elastic; -class GlobalElasticOptions +class ElasticsearchOptions { /** @var string */ private $host; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchSettingFormType.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php similarity index 94% rename from lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchSettingFormType.php rename to lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php index a950aa92b9..8c52d2c77c 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchSettingFormType.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php @@ -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'; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php index edc89e5494..32585829e5 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php @@ -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; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus.php index 3ef451a9e8..cbef4129de 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus.php @@ -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;