Skip to content

Commit

Permalink
Merge pull request wilr#63 from vyg/main
Browse files Browse the repository at this point in the history
feat: add raw algolia response to access facets and fix index batch
  • Loading branch information
wilr authored Aug 24, 2023
2 parents 1b93333 + 51396fc commit 5a15632
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/Service/AlgoliaQuerier.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ function array_key_first(array $arr)
->setPageLength($results['hitsPerPage']);
}

// add raw output from algoia for manipulation
$output->raw = $results;

return $output;
}

Expand Down
14 changes: 6 additions & 8 deletions src/Tasks/AlgoliaReindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,15 @@ public function indexItems($indexName, $items = null, $output = true)
public function indexBatch($indexName, $items): bool
{
$service = Injector::inst()->create(AlgoliaService::class);
$indexes = $service->getIndexByName($indexName);
$index = $service->getIndexByName($indexName);

try {
foreach ($indexes as $index) {
$result = $index->saveObjects($items, [
'autoGenerateObjectIDIfNotExist' => true
]);
$result = $index->saveObjects($items, [
'autoGenerateObjectIDIfNotExist' => true
]);

if (!$result->valid()) {
return false;
}
if (!$result->valid()) {
return false;
}

return true;
Expand Down

0 comments on commit 5a15632

Please sign in to comment.