Skip to content

Commit 079180e

Browse files
committed
Add sort index field for documents
1 parent bea24b6 commit 079180e

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

config/pimcore/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ pimcore_generic_data_index:
146146
type: keyword
147147
href:
148148
type: keyword
149+
index:
150+
type: integer
149151
data_object:
150152
published:
151153
type: boolean

doc/01_Installation/02_Upgrade.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Following steps are necessary during updating to newer versions.
44

5+
## Upgrade to 2.1.0
6+
- Added support for Symfony 7
7+
- [Indexing] Added sort index for documents
8+
- Execute the following command to reindex all elements to be able to use all new features:
9+
```bin/console generic-data-index:update:index -r```
10+
511
## Upgrade to 2.0.0
612
- [Indexing] Added inherited fields indicator to data object indexing
713
- [Indexing] Added functionality to enqueue dependent items

src/Model/Search/Document/SearchResult/DocumentSearchResultItem.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class DocumentSearchResultItem implements ElementSearchResultItemInterface
2828

2929
private string $key;
3030

31+
private int $index;
32+
3133
private bool $published;
3234

3335
private string $path;
@@ -109,6 +111,18 @@ public function setKey(string $key): DocumentSearchResultItem
109111
return $this;
110112
}
111113

114+
public function getIndex(): int
115+
{
116+
return $this->index;
117+
}
118+
119+
public function setIndex(int $index): DocumentSearchResultItem
120+
{
121+
$this->index = $index;
122+
123+
return $this;
124+
}
125+
112126
public function isPublished(): bool
113127
{
114128
return $this->published;

src/Service/Serializer/Denormalizer/Search/DocumentSearchResultDenormalizer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function denormalize(
5454
->setParentId(SystemField::PARENT_ID->getData($data))
5555
->setType(SystemField::TYPE->getData($data))
5656
->setKey(SystemField::KEY->getData($data))
57+
->setIndex(SystemField::INDEX->getData($data))
5758
->setPath(SystemField::PATH->getData($data))
5859
->setPublished(SystemField::PUBLISHED->getData($data))
5960
->setFullPath(SystemField::FULL_PATH->getData($data))

src/Service/Serializer/Normalizer/DocumentNormalizer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ private function normalizeSystemFields(Document $document, bool $skipLazyLoadedF
9797
SystemField::PUBLISHED->value => $document->isPublished(),
9898
SystemField::TYPE->value => $document->getType(),
9999
SystemField::KEY->value => $document->getKey(),
100+
SystemField::INDEX->value => $document->getIndex(),
100101
SystemField::PATH->value => $document->getPath(),
101102
SystemField::FULL_PATH->value => $document->getRealFullPath(),
102103
SystemField::USER_OWNER->value => $document->getUserOwner(),

0 commit comments

Comments
 (0)