Skip to content

Commit 0b32d75

Browse files
authored
use counting instead of modification date (#366)
1 parent 1a48c80 commit 0b32d75

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Service/SearchIndex/IndexElementIndexService.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ public function resetChildrenIndexBy(AbstractObject $element): void
8686
return;
8787
}
8888

89-
foreach ($this->getDataObjectChildren($element->getId()) as $child) {
89+
$index = 0;
90+
foreach ($this->getDataObjectChildren($element) as $child) {
9091
$this->bulkOperationService->addUpdate(
9192
$this->getIndexName($child, ElementType::DATA_OBJECT->value),
9293
$child['id'],
93-
[FieldCategory::SYSTEM_FIELDS->value => ['index' => $child['modificationDate']]],
94+
[FieldCategory::SYSTEM_FIELDS->value => ['index' => $index]],
9495
);
96+
97+
$index++;
9598
}
9699
}
97100

@@ -134,12 +137,12 @@ private function getDataObjectSiblingsQuery(): string
134137
/**
135138
* @throws Exception
136139
*/
137-
private function getDataObjectChildren(int $parentId): array
140+
private function getDataObjectChildren(AbstractObject $parent): array
138141
{
139142
return $this->dbResolver->get()->fetchAllAssociative(
140143
'SELECT id, `modificationDate`, `type`, `className` FROM ' . self::DATA_OBJECT_TABLE
141-
. ' WHERE parentId = ? ORDER BY `index` ASC',
142-
[$parentId]
144+
. ' WHERE parentId = ? ORDER BY `key` ' . $parent->getChildrenSortOrder(),
145+
[$parent->getId()]
143146
);
144147
}
145148

0 commit comments

Comments
 (0)