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
7 changes: 7 additions & 0 deletions doc/01_Installation/02_Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Following steps are necessary during updating to newer versions.

## Upgrade to 1.4.0
- [Indexing] Added class ID field for data object elements
- [Searching] Added new `ClassIdsFilter` modifier to search for data object elements by class ID or class name
- Execute the following command to reindex all elements to be able to use all new features:

```bin/console generic-data-index:update:index```

## Upgrade to 1.3.0
- [Indexing] Added support for Elasticsearch in parallel to Opensearch. Opensearch remains the default search technology. If you are using Elasticsearch, you need to update your symfony configuration as follows:
```yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $search->addModifier(new ParentIdFilter(1))
| [ExcludeFoldersFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/ExcludeFoldersFilter.php) | Basic filters | Exclude folders from search result |
| [ParentIdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/ParentIdsFilter.php) | Tree related filters | Filter by parent ID |
| [PathFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/PathFilter.php) | Tree related filters | Filter by path (depending on use case for all levels or direct children only and with or without the parent item included) |
| [ClassIdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/ClassIdsFilter.php) | Tree related filters | Filter object items by class IDs (depending on use case the folders can be included in the result) |
| [ClassIdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/ClassIdsFilter.php) | Tree related filters | Filter object items by class IDs (depending on use case the folders can be included in the result). Setting parameter `$useClassName` to `true` allows filtering based on the classNames instead |
| [TagFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/TagFilter.php) | Tree related filters | Filter by tag IDs (it is also possible to include child tags) |
| [AssetMetaDataFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Asset/AssetMetaDataFilter.php) | Asset filters | Filter by asset meta data attribute. The format of the `$data` which needs to be passed depends on the type of the meta data attribute and is handled by its [field definition adapter](https://github.com/pimcore/generic-data-index-bundle/tree/1.x/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter). |
| [WorkspaceQuery](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Workspaces/WorkspaceQuery.php) | Workspace related filters | Filter based on the user workspaces and permissions for a defined element type (this query is added to the asset/document/data object search by default) |
Expand Down
1 change: 1 addition & 0 deletions src/Enum/SearchIndex/FieldCategory/SystemField.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum SystemField: string
case TAGS = 'tags';
case PARENT_TAGS = 'parentTags';
case MIME_TYPE = 'mimetype';
case CLASS_ID = 'classId';
case CLASS_NAME = 'className';
case CLASS_DEFINITION_ICON = 'classDefinitionIcon';
case CHECKSUM = 'checksum';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class DataObjectSearchResultItem implements ElementSearchResultItemInterface

private ?int $modificationDate;

private string $classId;

private string $className;

private ?string $classDefinitionIcon;
Expand Down Expand Up @@ -266,6 +268,18 @@ public function setModificationDate(?int $modificationDate): DataObjectSearchRes
return $this;
}

public function getClassId(): string
{
return $this->classId;
}

public function setClassId(string $classId): DataObjectSearchResultItem
{
$this->classId = $classId;

return $this;
}

public function getClassName(): string
{
return $this->className;
Expand Down
8 changes: 7 additions & 1 deletion src/Model/Search/Modifier/Filter/Tree/ClassIdsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
{
public function __construct(
private array $classIds,
private bool $includeFolders = false
private bool $includeFolders = false,
private bool $useClassName = false
) {
}

Expand All @@ -38,4 +39,9 @@ public function includeFolders(): bool
{
return $this->includeFolders;
}

public function useClassName(): bool
{
return $this->useClassName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ public function handleClassesFilter(
return;
}

$field = SystemField::CLASS_ID;
if ($classesFilter->useClassName()) {
$field = SystemField::CLASS_NAME;
}

$query = new TermsFilter(
field: SystemField::CLASS_NAME->getPath('keyword'),
field: $field->getPath('keyword'),
terms: $classesFilter->getClassIds()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function denormalize(

$searchResultItem
->setId(SystemField::ID->getData($data))
->setClassId(SystemField::CLASS_ID->getData($data) ?? '')
->setClassName(SystemField::CLASS_NAME->getData($data) ?? '')
->setClassDefinitionIcon(SystemField::CLASS_DEFINITION_ICON->getData($data))
->setParentId(SystemField::PARENT_ID->getData($data))
Expand Down
1 change: 1 addition & 0 deletions src/Service/Serializer/Normalizer/DataObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private function normalizeSystemFields(AbstractObject $dataObject, bool $skipLaz

if ($dataObject instanceof Concrete) {
$result = array_merge($result, [
SystemField::CLASS_ID->value => $dataObject->getClassId(),
SystemField::CLASS_NAME->value => $dataObject->getClassName(),
SystemField::CLASS_DEFINITION_ICON->value => $dataObject->getClass()->getIcon() ?: null,
SystemField::PUBLISHED->value => $dataObject->getPublished(),
Expand Down
Loading