Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Query/SortBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function byFieldValue(
): SortBy {
$this->sortsBy[] = [
'type' => self::TYPE_FIELD,
"indexed_metadata.$field" => [
Filter::getFilterPathByField($field) => [
'order' => $order,
],
];
Expand Down
27 changes: 27 additions & 0 deletions Tests/Query/SortByTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,33 @@ public function testSortByFieldValue()
);
}

/**
* Test sort by field value.
*/
public function testSortByFieldValueBasicFields()
{
$sortBy = SortBy::create();
$sortBy->byFieldValue('id', SortBy::ASC);
$sortBy->byFieldValue('type', SortBy::ASC);
$this->assertEquals(
[
[
'type' => SortBy::TYPE_FIELD,
'uuid.id' => [
'order' => SortBy::ASC,
],
],
[
'type' => SortBy::TYPE_FIELD,
'uuid.type' => [
'order' => SortBy::ASC,
],
],
],
$sortBy->all()
);
}

/**
* Test sortby nested field and filter.
*/
Expand Down