Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
anvit committed Oct 21, 2024
1 parent 426515a commit 4f937f8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 4f937f8

Please sign in to comment.