Skip to content

Commit

Permalink
rename opensearch namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lukmzig committed Dec 18, 2024
1 parent 88a332c commit ae3c33c
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 67 deletions.
8 changes: 4 additions & 4 deletions config/data_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ services:
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\HydratorServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\HydratorService
arguments:
$assetHydratorLocator: '@open_search.asset_hydrator.service_locator'
$dataObjectHydratorLocator: '@open_search.data_object_hydrator.service_locator'
$assetHydratorLocator: '@search_index.asset_hydrator.service_locator'
$dataObjectHydratorLocator: '@search_index.data_object_hydrator.service_locator'

# Elements

Expand Down Expand Up @@ -81,7 +81,7 @@ services:


#Service Locator
open_search.asset_hydrator.service_locator:
search_index.asset_hydrator.service_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
tags: [ 'container.service_locator' ]
arguments:
Expand All @@ -95,7 +95,7 @@ services:
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Video: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\VideoHydratorInterface'

#Service Locator
open_search.data_object_hydrator.service_locator:
search_index.data_object_hydrator.service_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
tags: [ 'container.service_locator' ]
arguments:
Expand Down
52 changes: 26 additions & 26 deletions config/data_index_filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,82 +10,82 @@ services:
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\FilterLoaderInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Loader\TaggedIteratorAdapter

Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilter
Pimcore\Bundle\StudioBackendBundle\DataIndex\SearchIndexFilterInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\SearchIndexFilter
tags: [ 'pimcore.studio_backend.filter_service' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PageFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PageSizeFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\ExcludeFolderFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\IdSearchFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\ParentIdFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PathFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\TagFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PqlFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\UserFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\IdFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\IntegerFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\FullTextFilter:
tags: [ 'pimcore.studio_backend.open_search.filter' ]
tags: [ 'pimcore.studio_backend.search_index.filter' ]

# DataObject
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\DataObject\ClassNameFilter:
tags: [ 'pimcore.studio_backend.open_search.data_object.filter' ]
tags: [ 'pimcore.studio_backend.search_index.data_object.filter' ]

# Asset Metadata
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\SelectFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\InputFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\TextAreaFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\CheckboxFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\DateFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\AssetFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\DocumentFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\ObjectFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

# Asset System Data
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\System\StringFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\System\DatetimeFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]

# Asset
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\SortFilter:
tags: [ 'pimcore.studio_backend.open_search.asset.filter' ]
tags: [ 'pimcore.studio_backend.search_index.asset.filter' ]
8 changes: 4 additions & 4 deletions doc/10_Extending_Studio/03_Filters.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Extending Filters

Currently, there are two different filters systems implemented. The OpenSearch Filters and the Listing Filters.
Currently, there are two different filters systems implemented. The Search Index Filters and the Listing Filters.
The main difference lies in the implementation of the adapters and the tag.

The idea is that every filter knows for which type it is responsible and can be used in the according context.
Expand Down Expand Up @@ -127,9 +127,9 @@ final readonly class LikeFilter implements FilterInterface
```


## OpenSearch Filters
For assets, data objects and documents we are using OpenSearch to index the data and to provide a fast search.
For more details on how to implement the OpenSearch filters see the [OpenSearch Filters](04_Filters/01_OpenSearch_Filters.md).
## Search Index Filters
For assets, data objects and documents we are using OpenSearch or ElasticSearch (based on your Generic Data Index configuration) to index the data and to provide a fast search.
For more details on how to implement these filters see the [Search Index Filters](04_Filters/01_Search_Index_Filters.md).

## Listing Filters
For the classic approach of using listings, the Listing Filters are used.
Expand Down
11 changes: 0 additions & 11 deletions doc/10_Extending_Studio/04_Filters/01_OpenSearch_Filters.md

This file was deleted.

11 changes: 11 additions & 0 deletions doc/10_Extending_Studio/04_Filters/01_Search_Index_Filters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Extending Search Index Filters

The Filters are based on the [Generic Data Index Bundle](https://github.com/pimcore/generic-data-index-bundle) and provide an abstraction layer to add filters to an OpenSearch or Elasticsearch query.

Currently, there are queries for assets, data objects and documents implemented.

## Adding a new Search Index Filter
In order to add a new filter, you need to implement the `Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\FilterInterface` and register the service with the tag `pimcore.studio_backend.search_index.filter`

## Available Search Modifiers for Queries
For a full list of the available search modifiers, please refer to the [Generic Data Index Bundle](https://github.com/pimcore/generic-data-index-bundle/tree/1.x/doc/04_Searching_For_Data_In_Index/05_Search_Modifiers.md)
2 changes: 1 addition & 1 deletion doc/10_Extending_Studio/04_Filters/02_Listing_Filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The Listing Filters are based on the Pimcore Listing classes and provide an abstraction layer to add filters to a listing.

## Adding a new Listing Filter
In order to add a new OpenSearch Filter, you need to implement the `Pimcore\Bundle\StudioBackendBundle\Listing\Filter\FilterInterface` and register the service with the tag `pimcore.studio_backend.listing.filter`
In order to add a new Filter, you need to implement the `Pimcore\Bundle\StudioBackendBundle\Listing\Filter\FilterInterface` and register the service with the tag `pimcore.studio_backend.listing.filter`

## AbstractListing vs CallableListingInterface
Unfortunately not all listings for the same.
Expand Down
2 changes: 1 addition & 1 deletion doc/10_Extending_Studio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The main topics that can be extended are:
- [Endpoints](01_Endpoints.md)
- [OpenApi](02_OpenApi.md)
- [Filters](03_Filters.md)
- [OpenSearch Filters](04_Filters/01_OpenSearch_Filters.md)
- [Search Index Filters](04_Filters/01_Search_Index_Filters.md)
- [Listing Filters](04_Filters/02_Listing_Filters.md)
- [Grids](05_Grid.md)
- [Update & Patcher](06_Update_Patch.md)
Expand Down
6 changes: 3 additions & 3 deletions src/Asset/Service/AssetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Pimcore\Bundle\StudioBackendBundle\Asset\Schema\Type\Unknown;
use Pimcore\Bundle\StudioBackendBundle\Asset\Schema\Type\Video;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\SearchIndexFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\AssetQueryInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Request\ElementParameters;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\AccessDeniedException;
Expand Down Expand Up @@ -79,8 +79,8 @@ public function __construct(
*/
public function getAssets(ElementParameters $parameters): Collection
{
/** @var OpenSearchFilterInterface $filterService */
$filterService = $this->filterServiceProvider->create(OpenSearchFilterInterface::SERVICE_TYPE);
/** @var SearchIndexFilterInterface $filterService */
$filterService = $this->filterServiceProvider->create(SearchIndexFilterInterface::SERVICE_TYPE);

/** @var AssetQueryInterface $assetQuery */
$assetQuery = $filterService->applyFilters(
Expand Down
2 changes: 1 addition & 1 deletion src/DataIndex/Filter/Asset/Metadata/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata;

use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter as GenericDateFilter;
use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter as GenericDateFilter;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\IsAssetFilterTrait;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\FilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\AssetQueryInterface;
Expand Down
1 change: 0 additions & 1 deletion src/DataIndex/Filter/IdSearchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface
}

$idSearchTerm = $parameters->getIdSearchTerm();

if (!$idSearchTerm) {
return $query;
}
Expand Down
8 changes: 4 additions & 4 deletions src/DataIndex/Filter/Loader/TaggedIteratorAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
*/
final class TaggedIteratorAdapter implements FilterLoaderInterface
{
public const FILTER_TAG = 'pimcore.studio_backend.open_search.filter';
public const FILTER_TAG = 'pimcore.studio_backend.search_index.filter';

public const FILTER_ASSET_TAG = 'pimcore.studio_backend.open_search.asset.filter';
public const FILTER_ASSET_TAG = 'pimcore.studio_backend.search_index.asset.filter';

public const FILTER_DATA_OBJECT_TAG = 'pimcore.studio_backend.open_search.data_object.filter';
public const FILTER_DATA_OBJECT_TAG = 'pimcore.studio_backend.search_index.data_object.filter';

public const FILTER_DOCUMENT_TAG = 'pimcore.studio_backend.open_search.document.filter';
public const FILTER_DOCUMENT_TAG = 'pimcore.studio_backend.search_index.document.filter';

public function __construct(
#[TaggedIterator(self::FILTER_TAG)]
Expand Down
6 changes: 3 additions & 3 deletions src/DataIndex/Grid/GridSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\DataObjectSearchResult;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\DataObjectSearchServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\SearchIndexFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\AssetQueryInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\DataObjectQueryInterface;
use Pimcore\Bundle\StudioBackendBundle\DataObject\Schema\Type\DataObjectFolder;
Expand All @@ -41,15 +41,15 @@
*/
final readonly class GridSearch implements GridSearchInterface
{
private OpenSearchFilterInterface $filterService;
private SearchIndexFilterInterface $filterService;

public function __construct(
private FilterServiceProviderInterface $filterServiceProvider,
private AssetSearchServiceInterface $assetSearchService,
private DataObjectSearchServiceInterface $dataObjectSearchService,
private SecurityServiceInterface $securityService
) {
$this->filterService = $this->filterServiceProvider->create(OpenSearchFilterInterface::SERVICE_TYPE);
$this->filterService = $this->filterServiceProvider->create(SearchIndexFilterInterface::SERVICE_TYPE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* @internal
*/
final readonly class OpenSearchFilter implements OpenSearchFilterInterface
final readonly class SearchIndexFilter implements SearchIndexFilterInterface
{
public function __construct(
private FilterLoaderInterface $filterLoader,
Expand Down Expand Up @@ -76,6 +76,6 @@ private function getTypeFilters(Filters $filters, string $type): array

public function getType(): string
{
return OpenSearchFilterInterface::SERVICE_TYPE;
return SearchIndexFilterInterface::SERVICE_TYPE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
/**
* @internal
*/
interface OpenSearchFilterInterface extends FilterServiceInterface
interface SearchIndexFilterInterface extends FilterServiceInterface
{
public const SERVICE_TYPE = 'open_search_filter';
public const SERVICE_TYPE = 'search_index_filter';

/**
* @throws InvalidQueryTypeException|InvalidFilterTypeException
Expand Down
6 changes: 3 additions & 3 deletions src/DataObject/Service/DataObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\DataObjectServiceResolverInterface;
use Pimcore\Bundle\StaticResolverBundle\Models\Element\ServiceResolverInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\DataObjectSearchServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\SearchIndexFilterInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\DataObjectQuery;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\QueryInterface;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Request\DataObjectParameters;
Expand Down Expand Up @@ -123,8 +123,8 @@ public function addDataObject(
*/
public function getDataObjects(DataObjectParameters $parameters): Collection
{
/** @var OpenSearchFilterInterface $filterService */
$filterService = $this->filterServiceProvider->create(OpenSearchFilterInterface::SERVICE_TYPE);
/** @var SearchIndexFilterInterface $filterService */
$filterService = $this->filterServiceProvider->create(SearchIndexFilterInterface::SERVICE_TYPE);

$query = $filterService->applyFilters(
$parameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use Codeception\Stub\Expected;
use Codeception\Test\Unit;
use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter as GenericDateFilter;
use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter as GenericDateFilter;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\DateFilter;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Asset\Metadata\FilterType;
use Pimcore\Bundle\StudioBackendBundle\DataIndex\Query\AssetQueryInterface;
Expand Down

0 comments on commit ae3c33c

Please sign in to comment.