Skip to content
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: 2 additions & 0 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ pimcore_generic_data_index:
document:
published:
type: boolean
index:
type: integer
controller:
type: keyword
template:
Expand Down
6 changes: 6 additions & 0 deletions doc/01_Installation/02_Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Following steps are necessary during updating to newer versions.

## Upgrade to 2.1.0
- Added support for Symfony 7
- [Indexing] Added sort index for documents
- Execute the following command to reindex all elements to be able to use all new features:
```bin/console generic-data-index:update:index -r```

## Upgrade to 2.0.0
- [Indexing] Added inherited fields indicator to data object indexing
- [Indexing] Added functionality to enqueue dependent items
Expand Down
10 changes: 5 additions & 5 deletions doc/04_Searching_For_Data_In_Index/05_Search_Modifiers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ $search->addModifier(new ParentIdFilter(1))

If multiple sort modifiers are added to the search, the order of the modifiers is important. The search result will be sorted by the first added modifier first, then by the second added modifier and so on.

| Modifier | Modifier Category | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [OrderByFullPath](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByFullPath.php) | Tree related sorting | Order by full path (including element key) |
| Modifier | Modifier Category | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [OrderByFullPath](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByFullPath.php) | Tree related sorting | Order by full path (including element key) |
| [OrderByField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) | Field based sorting | Order by given field name.<br/>If `$enablePqlFieldNameResolution` is set to true (default) [Pimcore Query Language](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) field name resolution logic is enabled. Therefore it's possible to use short field names then instead of specifying the full indexed path. |
| [OrderByPageNumber](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByPageNumber.php) | Search related sorting | Use inverted search for large amounts of data (this modifier is added to the search when there are at least 1000 results by default, and page number is above the half of total pages. Furthermore, existing sorting has to be already applied.) |
| [OrderByIndexField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByIndexField.php) | Search related sorting | Order by object tree index for custom tree sorting. This modifier is currently applied only for data objects! |
| [OrderByPageNumber](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByPageNumber.php) | Search related sorting | Use inverted search for large amounts of data (this modifier is added to the search when there are at least 1000 results by default, and page number is above the half of total pages. Furthermore, existing sorting has to be already applied.) |
| [OrderByIndexField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByIndexField.php) | Search related sorting | Order by element tree index for custom tree sorting. This modifier is currently applied only for data objects and documents! |

### Aggregations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class DocumentSearchResultItem implements ElementSearchResultItemInterface

private string $key;

private int $index;

private bool $published;

private string $path;
Expand Down Expand Up @@ -109,6 +111,18 @@ public function setKey(string $key): DocumentSearchResultItem
return $this;
}

public function getIndex(): int
{
return $this->index;
}

public function setIndex(int $index): DocumentSearchResultItem
{
$this->index = $index;

return $this;
}

public function isPublished(): bool
{
return $this->published;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort;
use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList;
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearch;
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearch;
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\OrderByPageNumber;
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\Tree\OrderByFullPath;
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\Tree\OrderByIndexField;
Expand Down Expand Up @@ -97,7 +98,9 @@ public function handleIndexSort(
OrderByIndexField $indexSort,
SearchModifierContextInterface $context
): void {
if (!$context->getOriginalSearch() instanceof DataObjectSearch) {
if (!$context->getOriginalSearch() instanceof DataObjectSearch &&
!$context->getOriginalSearch() instanceof DocumentSearch
) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function denormalize(
->setParentId(SystemField::PARENT_ID->getData($data))
->setType(SystemField::TYPE->getData($data))
->setKey(SystemField::KEY->getData($data))
->setIndex(SystemField::INDEX->getData($data))
->setPath(SystemField::PATH->getData($data))
->setPublished(SystemField::PUBLISHED->getData($data))
->setFullPath(SystemField::FULL_PATH->getData($data))
Expand Down
1 change: 1 addition & 0 deletions src/Service/Serializer/Normalizer/DocumentNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private function normalizeSystemFields(Document $document, bool $skipLazyLoadedF
SystemField::PUBLISHED->value => $document->isPublished(),
SystemField::TYPE->value => $document->getType(),
SystemField::KEY->value => $document->getKey(),
SystemField::INDEX->value => $document->getIndex(),
SystemField::PATH->value => $document->getPath(),
SystemField::FULL_PATH->value => $document->getRealFullPath(),
SystemField::USER_OWNER->value => $document->getUserOwner(),
Expand Down