From e6a7473355a2346f4dde73f696ea0b73c8bac1f0 Mon Sep 17 00:00:00 2001 From: Anvit Srivastav Date: Wed, 9 Oct 2024 16:06:44 -0700 Subject: [PATCH] Fix linting errors --- .../actions/autocompleteAction.class.php | 2 +- .../arElasticSearchIndexDecorator.class.php | 26 ++++++++++++------- .../lib/arElasticSearchPluginUtil.class.php | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/qubit/modules/search/actions/autocompleteAction.class.php b/apps/qubit/modules/search/actions/autocompleteAction.class.php index 293aaeecce..ef9a40c45c 100644 --- a/apps/qubit/modules/search/actions/autocompleteAction.class.php +++ b/apps/qubit/modules/search/actions/autocompleteAction.class.php @@ -76,7 +76,7 @@ public function execute($request) foreach ($items as $item) { $search = new \Elastica\Search($client); - foreach($indices as $type => $index) { + foreach ($indices as $type => $index) { $itemType = QubitSearch::getInstance()->index->getIndexTypeName($item['type']); $search->addIndex($index)->addType($index->getType($itemType)); } diff --git a/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php b/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php index d285786910..cbcb1e1f4d 100644 --- a/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php +++ b/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php @@ -30,45 +30,53 @@ public function __construct($prefix) $this->_indexPrefix = $prefix; } - public function createIndex($typeName, Elastica\Index $index) { + public function createIndex($typeName, Elastica\Index $index) + { $typeName = $this->getIndexTypeName($typeName); $this->_instance[$typeName] = $index; } // Converts camelized Qubit class names to lower case index name used for ElasticSearch - public function getIndexTypeName($typeName) { - return $this->_indexPrefix . '_' . strtolower($typeName); + public function getIndexTypeName($typeName) + { + return $this->_indexPrefix.'_'.strtolower($typeName); } - public function delete() { + public function delete() + { foreach ($this->_instance as $index) { $index->delete(); } } - public function addDocuments($typeName, $documents) { + public function addDocuments($typeName, $documents) + { $typeName = $this->getIndexTypeName($typeName); $this->_instance[$typeName]->addDocuments($documents); } - public function deleteDocuments($typeName, $documents) { + public function deleteDocuments($typeName, $documents) + { $typeName = $this->getIndexTypeName($typeName); $this->_instance[$typeName]->deleteDocuments($documents); } - public function refresh() { + public function refresh() + { foreach ($this->_instance as $index) { $index->refresh(); } } - public function getType($typeName) { + public function getType($typeName) + { $typeName = $this->getIndexTypeName($typeName); return $this->_instance[$typeName]; } - public function getInstance() { + public function getInstance() + { return $this->_instance; } } diff --git a/plugins/arElasticSearchPlugin/lib/arElasticSearchPluginUtil.class.php b/plugins/arElasticSearchPlugin/lib/arElasticSearchPluginUtil.class.php index 62485f9698..8fafdf71d9 100644 --- a/plugins/arElasticSearchPlugin/lib/arElasticSearchPluginUtil.class.php +++ b/plugins/arElasticSearchPlugin/lib/arElasticSearchPluginUtil.class.php @@ -483,7 +483,7 @@ protected static function getAllObjectStringFields( elseif ( ( !isset($propertyProperties['copy_to']) - || ($propertyProperties['copy_to'] == '_all') + || ('_all' == $propertyProperties['copy_to']) ) && ( isset($propertyProperties['type']) && 'text' == $propertyProperties['type']