Skip to content

Commit

Permalink
fix: restructure. Escape split records.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed May 23, 2024
1 parent a93e2b1 commit 9b55d4b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/php/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,26 @@ public function index($post)

try {

//Catch error here.
json_encode($post, JSON_THROW_ON_ERROR);

//Index post
if (self::recordToLarge($post)) {
$splitRecord = self::splitRecord($post);
$splitRecord = self::utf8ize($splitRecord);

if (is_array($splitRecord) && !empty($splitRecord)) {

//Catch error here.
json_encode($splitRecord, JSON_THROW_ON_ERROR);

Instance::getIndex()->saveObjects(
$splitRecord,
['objectIDKey' => 'uuid']
);
}
} else {

//Catch error here.
json_encode($post, JSON_THROW_ON_ERROR);

Instance::getIndex()->saveObject(
$post,
['objectIDKey' => 'uuid']
Expand Down

0 comments on commit 9b55d4b

Please sign in to comment.