Package io.jmix.search.index.impl
Class BaseEntityIndexer
java.lang.Object
io.jmix.search.index.impl.BaseEntityIndexer
- All Implemented Interfaces:
EntityIndexer
- Direct Known Subclasses:
ElasticsearchEntityIndexer
,OpenSearchEntityIndexer
Provides non-platform-specific functionality.
Interaction with indexes is performed in platform-specific implementations.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final record
-
Field Summary
Modifier and TypeFieldDescriptionprotected final UnconstrainedDataManager
protected final FetchPlans
protected final IdSerialization
protected final IndexConfigurationManager
protected final IndexStateRegistry
protected final Metadata
protected final MetadataTools
protected final com.fasterxml.jackson.databind.ObjectMapper
protected final SearchProperties
-
Constructor Summary
ConstructorDescriptionBaseEntityIndexer
(UnconstrainedDataManager dataManager, FetchPlans fetchPlans, IndexConfigurationManager indexConfigurationManager, Metadata metadata, IdSerialization idSerialization, IndexStateRegistry indexStateRegistry, MetadataTools metadataTools, SearchProperties searchProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFieldValueToEntityIndexContent
(com.fasterxml.jackson.databind.node.ObjectNode entityIndexContent, MappingFieldDescriptor field, Object entity) protected FetchPlan
createFetchPlan
(IndexConfiguration indexConfiguration) protected com.fasterxml.jackson.databind.node.ObjectNode
createObjectNodeForField
(String key, com.fasterxml.jackson.databind.JsonNode value) Deletes provided entity instance from index.deleteByEntityId
(Id<?> entityId) Deletes entity instance from index by provided ID.protected abstract IndexResult
deleteByGroupedDocIds
(Map<IndexConfiguration, Collection<String>> groupedDocIds) protected IndexResult
deleteByGroupedIndexIdsInternal
(Map<IndexConfiguration, Collection<String>> groupedIndexIds) deleteCollection
(Collection<Object> entityInstances) Deletes provided entity instances from index.deleteCollectionByEntityIds
(Collection<Id<?>> entityIds) Deletes entity instances from index by provided IDs.protected BaseEntityIndexer.IndexDocumentData
generateIndexDocument
(IndexConfiguration indexConfiguration, Object instance) Stores provided entity instance to index.indexByEntityId
(Id<?> entityId) Stores entity instance to index by provided ID.indexCollection
(Collection<Object> entityInstances) Stores provided entity instances to index.indexCollectionByEntityIds
(Collection<Id<?>> entityIds) Stores entity instances to index by provided IDs.protected abstract IndexResult
indexDocuments
(List<BaseEntityIndexer.IndexDocumentData> documents) protected IndexResult
indexGroupedInstances
(Map<IndexConfiguration, Collection<Object>> groupedInstances) protected void
merge
(com.fasterxml.jackson.databind.JsonNode toBeMerged, com.fasterxml.jackson.databind.JsonNode mergedInTo) protected Map<IndexConfiguration,
Collection<String>> prepareIndexIdsByEntityIds
(Collection<Id<?>> entityIds) protected Map<IndexConfiguration,
Collection<String>> prepareIndexIdsByEntityInstances
(Collection<Object> instances) protected Map<IndexConfiguration,
Collection<Object>> prepareInstancesForIndexing
(Collection<Object> instances) protected Map<IndexConfiguration,
Collection<Object>> prepareInstancesForIndexingByIds
(Collection<Id<?>> entityIds) protected Map<IndexConfiguration,
Collection<Object>> reloadEntityInstances
(Map<MetaClass, List<Object>> idsGroupedByMetaClass) protected void
updateArray
(com.fasterxml.jackson.databind.JsonNode valueToBePlaced, Map.Entry<String, com.fasterxml.jackson.databind.JsonNode> toBeMerged) protected void
updateObject
(com.fasterxml.jackson.databind.JsonNode mergeInTo, com.fasterxml.jackson.databind.node.ValueNode valueToBePlaced, Map.Entry<String, com.fasterxml.jackson.databind.JsonNode> toBeMerged)
-
Field Details
-
dataManager
-
fetchPlans
-
indexConfigurationManager
-
metadata
-
idSerialization
-
indexStateRegistry
-
metadataTools
-
searchProperties
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
BaseEntityIndexer
public BaseEntityIndexer(UnconstrainedDataManager dataManager, FetchPlans fetchPlans, IndexConfigurationManager indexConfigurationManager, Metadata metadata, IdSerialization idSerialization, IndexStateRegistry indexStateRegistry, MetadataTools metadataTools, SearchProperties searchProperties)
-
-
Method Details
-
index
Description copied from interface:EntityIndexer
Stores provided entity instance to index.- Specified by:
index
in interfaceEntityIndexer
- Parameters:
entityInstance
- instance- Returns:
IndexResult
-
indexCollection
Description copied from interface:EntityIndexer
Stores provided entity instances to index.- Specified by:
indexCollection
in interfaceEntityIndexer
- Parameters:
entityInstances
- instances- Returns:
IndexResult
-
indexByEntityId
Description copied from interface:EntityIndexer
Stores entity instance to index by provided ID.- Specified by:
indexByEntityId
in interfaceEntityIndexer
- Parameters:
entityId
- ID of entity instance- Returns:
IndexResult
-
indexCollectionByEntityIds
Description copied from interface:EntityIndexer
Stores entity instances to index by provided IDs.- Specified by:
indexCollectionByEntityIds
in interfaceEntityIndexer
- Parameters:
entityIds
- IDs of entity instances- Returns:
IndexResult
-
delete
Description copied from interface:EntityIndexer
Deletes provided entity instance from index.- Specified by:
delete
in interfaceEntityIndexer
- Parameters:
entityInstance
- instance- Returns:
IndexResult
-
deleteCollection
Description copied from interface:EntityIndexer
Deletes provided entity instances from index.- Specified by:
deleteCollection
in interfaceEntityIndexer
- Parameters:
entityInstances
- instances- Returns:
IndexResult
-
deleteByEntityId
Description copied from interface:EntityIndexer
Deletes entity instance from index by provided ID.- Specified by:
deleteByEntityId
in interfaceEntityIndexer
- Parameters:
entityId
- ID of entity instance- Returns:
IndexResult
-
deleteCollectionByEntityIds
Description copied from interface:EntityIndexer
Deletes entity instances from index by provided IDs.- Specified by:
deleteCollectionByEntityIds
in interfaceEntityIndexer
- Parameters:
entityIds
- IDs of entity instances- Returns:
IndexResult
-
indexDocuments
-
deleteByGroupedDocIds
protected abstract IndexResult deleteByGroupedDocIds(Map<IndexConfiguration, Collection<String>> groupedDocIds) -
indexGroupedInstances
protected IndexResult indexGroupedInstances(Map<IndexConfiguration, Collection<Object>> groupedInstances) -
deleteByGroupedIndexIdsInternal
protected IndexResult deleteByGroupedIndexIdsInternal(Map<IndexConfiguration, Collection<String>> groupedIndexIds) -
prepareInstancesForIndexing
protected Map<IndexConfiguration,Collection<Object>> prepareInstancesForIndexing(Collection<Object> instances) -
prepareInstancesForIndexingByIds
protected Map<IndexConfiguration,Collection<Object>> prepareInstancesForIndexingByIds(Collection<Id<?>> entityIds) -
prepareIndexIdsByEntityInstances
protected Map<IndexConfiguration,Collection<String>> prepareIndexIdsByEntityInstances(Collection<Object> instances) -
prepareIndexIdsByEntityIds
protected Map<IndexConfiguration,Collection<String>> prepareIndexIdsByEntityIds(Collection<Id<?>> entityIds) -
reloadEntityInstances
protected Map<IndexConfiguration,Collection<Object>> reloadEntityInstances(Map<MetaClass, List<Object>> idsGroupedByMetaClass) -
createFetchPlan
-
generateIndexDocument
protected BaseEntityIndexer.IndexDocumentData generateIndexDocument(IndexConfiguration indexConfiguration, Object instance) -
addFieldValueToEntityIndexContent
protected void addFieldValueToEntityIndexContent(com.fasterxml.jackson.databind.node.ObjectNode entityIndexContent, MappingFieldDescriptor field, Object entity) -
createObjectNodeForField
protected com.fasterxml.jackson.databind.node.ObjectNode createObjectNodeForField(String key, com.fasterxml.jackson.databind.JsonNode value) -
merge
protected void merge(com.fasterxml.jackson.databind.JsonNode toBeMerged, com.fasterxml.jackson.databind.JsonNode mergedInTo) -
updateArray
-
updateObject
-