Created
July 30, 2022 12:27
-
-
Save wazum/30c1a02894c9e1ad3cb5c619a28e4528 to your computer and use it in GitHub Desktop.
My Batch Handler Solr example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
… | |
$documents = []; | |
foreach ($jobs as [$job, $ack]) { | |
try { | |
$documents[] = $this->solrService->createDocument($job->something()); | |
$ack->ack($job); | |
} catch (\Exception $e) { | |
$ack->nack($e); | |
} | |
} | |
… | |
// Index documents in Solr using Solarium PHP client | |
… | |
$update->addDocuments($documents); | |
$update->addCommit(); | |
$client->update($update); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment