Skip to content

Commit

Permalink
Reverse sort the keys in JSON array
Browse files Browse the repository at this point in the history
`type` should be first, `coordinates` should be second
  • Loading branch information
beatrycze-volk committed Nov 28, 2024
1 parent f088772 commit 1101d75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Classes/Common/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ protected static function processLogical(Document $document, array $logicalUnit)
$solrDoc->setField('restrictions', $metadata['restrictions']);
$coordinates = json_decode($metadata['coordinates'][0]);
if (is_object($coordinates)) {
$solrDoc->setField('geom', json_encode($coordinates->features[0]));
$feature = (array) $coordinates->features[0];
$geometry = (array) $feature['geometry'];
krsort($geometry);
$feature['geometry'] = $geometry;
$solrDoc->setField('geom', json_encode($feature));
}
$autocomplete = self::processMetadata($document, $metadata, $solrDoc);
// Add autocomplete values to index.
Expand Down

0 comments on commit 1101d75

Please sign in to comment.