useIdSorting example

if (\count($pk) === 1) {
                $pk = array_shift($pk);
            }

            $converted[$arrayKey] = [
                'primaryKey' => $pk,
                'data' => $data,
            ];
        }

        if ($criteria->useIdSorting()) {
            $converted = $this->sortByIdArray($criteria->getIds()$converted);
        }

        return new IdSearchResult($total$converted$criteria$context);
    }

    private function addTotalCountMode(Criteria $criteria, QueryBuilder $query): void
    {
        if ($criteria->getTotalCountMode() !== Criteria::TOTAL_COUNT_MODE_NEXT_PAGES) {
            return;
        }

        
$data[$id] = [
                'primaryKey' => $id,
                'data' => array_merge(
                    $hit['_source'] ?? [],
                    ['id' => $id, '_score' => $hit['_score']]
                ),
            ];
        }

        $total = $this->getTotalValue($criteria$result);

        if ($criteria->useIdSorting()) {
            $data = $this->sortByIdArray($criteria->getIds()$data);
        }

        return new IdSearchResult($total$data$criteria$context);
    }

    private function extractHits(array $result): array
    {
        $records = [];
        $hits = $result['hits']['hits'];

        
Home | Imprint | This part of the site doesn't use cookies.