pimcore / advanced-object-search
Installs: 140 249
Dependents: 0
Suggesters: 0
Security: 0
Stars: 39
Watchers: 16
Forks: 44
Open Issues: 16
Type:pimcore-bundle
Requires
- handcraftedinthealps/elasticsearch-dsl: ^8.0
- pimcore/opensearch-client: ^1.0.0
- pimcore/pimcore: ^11.1
- symfony/config: ^6.2
- symfony/console: ^6.2
- symfony/dependency-injection: ^6.2
- symfony/event-dispatcher: ^6.2
- symfony/http-foundation: ^6.2
- symfony/http-kernel: ^6.2
- symfony/messenger: ^6.2
- symfony/routing: ^6.2
Requires (Dev)
- phpstan/phpstan: ^1.9.11
- 6.x-dev
- 6.0.x-dev
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- 5.0.x-dev
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v5.0.0-RC1
- v5.0.0-BETA1
- v4.3.4
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.3.1
- v3.3.0
- v3.2.0
- v3.1.7
- v3.1.6
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.12.1
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.0
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- 1.1.1
- 1.1.0
- v1.0.1
- v1.0.0
- dev-request-input-explicit
- dev-security-doc
This package is auto-updated.
Last update: 2024-10-30 13:09:31 UTC
README
Pimcore Advanced Object Search via OpenSearch
Advanced Object Search bundle provides advanced object search in Pimcore backend powered by OpenSearch.
Integration into Pimcore
Installation and Configuration
Follow Installation instructions.
Configure OpenSearch Client
OpenSearch client configuration takes place via Pimcore OpenSearch Client Bundle and has two parts.
- Configuring an OpenSearch client.
- Define the client to be used by advanced object search.
# Configure an OpenSearch client pimcore_open_search_client: clients: default: hosts: ['https://opensearch:9200'] password: 'admin' username: 'admin' ssl_verification: false # Define the client to be used by advanced object search advanced_object_search: client_name: default # default is default value here, just need to be specified when other client should be used.
If nothing is configured, a default client connecting to localhost:9200
is used.
Configure Advanced Object Search
Before starting, setup at least following configuration in symfony configuration tree:
advanced_object_search: # Prefix for index names index_name_prefix: 'advanced_object_search_'
For further configuration options follow the docs and the inline description of the configuration tree.
Initial Indexing
Call Pimcore command advanced-object-search:update-mapping
for creating mappings and advanced-object-search:re-index
for indexing data for the first time.
GUI
GUI for creating searches against search index with
- saving functionality
- sharing functionality
Plugin Hooks
Following event listeners are called automatically
pimcore.dataobject.postUpdate
- data object is updated in search index, all child objects are added to update queue.pimcore.dataobject.preDelete
- data object is deleted from search index.pimcore.class.postUpdate
- search index mapping is updated or index recreated if necessary.
Pimcore Console
Functions in Pimcore console.
advanced-object-search:process-update-queue
--> processes whole update queue of es search index.advanced-object-search:re-index
--> Reindex all data objects of given class. Does not delete index first or resets update queue.advanced-object-search:update-mapping
--> Deletes and recreates mapping of given classes. Resets update queue for given class.
For details see documentation directly in Pimcore console.
Pimcore Maintenance & Symfony Messenger
By default, with every Pimcore maintenance call, 500 entries of update queue are processed. As an alternative, you also can activate symfony messenger to process the update queue. For that, just activate it as follows.
advanced_object_search: messenger_queue_processing: activated: true
If activated, the processing is kicked off automatically with the advancedobjectsearch_update_queue
maintenance task.
Messages are dispatched via pimcore_index_queues
transport. So make sure, you have
workers processing this transport when activating the messenger based queue processing.
API Methods
Create Mapping for data object classes
Per data object class one index with one document type is created.
<?php /** * @var \AdvancedObjectSearchBundle\Service $service */ $service = $this->get("AdvancedObjectSearchBundle\Service"); $service->updateMapping(ClassDefinition::getByName("Product"));
Update index data
On data object save or via script:
<?php /** * @var \AdvancedObjectSearchBundle\Service $service */ $service = $this->get("AdvancedObjectSearchBundle\Service"); $objects = Product::getList(); foreach($objects as $object) { $service->doUpdateIndexData($object); }
Search/Filter for data
<?php /** * @var \AdvancedObjectSearchBundle\Service $service */ $service = $this->get("AdvancedObjectSearchBundle\Service"); //filter for relations via ID $results = $service->doFilter(3, [ new FilterEntry( "objects", [ "type" => "object", "id" => 75 ], BoolQuery::SHOULD ) ], "" ); //filter for relations via sub query $results = $service->doFilter(3, [ [ "fieldname" => "objects", "filterEntryData" => [ "type" => "object", "className" => "Customer", "filters" => [ [ "fieldname" => "firstname", "filterEntryData" => "tom" ] ] ] ], ], "" ); // full text search query without filters $results = $service->doFilter(3, [], "sony" ); // filter for several attributes - e.g. number field, input, localized fields $results = $service->doFilter(3, [ [ "fieldname" => "price", "filterEntryData" => 50.77 ], [ "fieldname" => "price2", "filterEntryData" => [ "gte" => 50.77, "lte" => 50.77 ] ], [ "fieldname" => "keywords", "filterEntryData" => "test2", "operator" => BoolQuery::SHOULD ], [ "fieldname" => "localizedfields", "filterEntryData" => [ "en" => [ "fieldname" => "locname", "filterEntryData" => "englname" ] ] ], [ "fieldname" => "localizedfields", "filterEntryData" => [ "de" => [ "fieldname" => "locname", "filterEntryData" => "deutname" ] ] ], new FilterEntry("keywords", "testx", BoolQuery::SHOULD) ], "" );
Not Supported Data Types
Currently following data types are not supported - but can be added if needed in future versions:
- ClassificationStore
- Slider
- Password
- Block
- Table
- StructuredTable
- Geographic data types
- Image data types
Integrate new Data Type
- Implement Field Definition Adapter by implementing the
IFieldDefinitionAdapter
interface. - Register new Field Definition Adapter as service
- Add mapping in configuration like
advanced_object_search: field_definition_adapters: newDataTypeName: SERVICE_ID_OF_FIELD_DEFINITION_ADAPTER
Extend Filters in the Result Tab
If you want custom filters in the result tab directly without having to create a new advanced object search every time read here on how to extend the result tab with custom filters.