Class ElasticsearchEntitySearcher
java.lang.Object
io.jmix.searchelasticsearch.searching.impl.ElasticsearchEntitySearcher
- All Implemented Interfaces:
EntitySearcher
Implementation for Elasticsearch
-
Field Summary
Modifier and TypeFieldDescriptionprotected final co.elastic.clients.elasticsearch.ElasticsearchClient
protected final IdSerialization
protected final IndexConfigurationManager
protected final InstanceNameProvider
protected final Metadata
protected final MetadataTools
protected final com.fasterxml.jackson.databind.ObjectMapper
protected final PolicyStore
protected final SearchProperties
protected final ElasticsearchSearchStrategyProvider
protected final SearchUtils
protected final DataManager
protected final SecureOperations
-
Constructor Summary
ConstructorDescriptionElasticsearchEntitySearcher
(co.elastic.clients.elasticsearch.ElasticsearchClient client, IndexConfigurationManager indexConfigurationManager, Metadata metadata, MetadataTools metadataTools, DataManager secureDataManager, InstanceNameProvider instanceNameProvider, SearchProperties searchProperties, IdSerialization idSerialization, SecureOperations secureOperations, PolicyStore policyStore, ElasticsearchSearchStrategyProvider searchStrategyManager, SearchUtils searchUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyPostStrategyRequestSettings
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder builder, SearchContext searchContext, int offset) protected void
configureHighlight
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder) protected co.elastic.clients.elasticsearch.core.SearchRequest
createRequest
(SearchContext searchContext, List<String> targetIndexes, ElasticsearchSearchStrategy searchStrategy, int offset) protected SearchResultEntry
createSearchResultEntry
(String entityId, String instanceName, String entityName, co.elastic.clients.elasticsearch.core.search.Hit<com.fasterxml.jackson.databind.node.ObjectNode> searchHit) protected void
fillSearchResult
(SearchResultImpl searchResultImpl, Map<MetaClass, List<co.elastic.clients.elasticsearch.core.search.Hit<com.fasterxml.jackson.databind.node.ObjectNode>>> hitsByEntityName) protected String
formatFieldName
(String fieldName) protected Map<MetaClass,
List<co.elastic.clients.elasticsearch.core.search.Hit<com.fasterxml.jackson.databind.node.ObjectNode>>> groupHitsByEntity
(co.elastic.clients.elasticsearch.core.search.HitsMetadata<com.fasterxml.jackson.databind.node.ObjectNode> hits) protected void
initRequest
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder builder, List<String> targetIndexes) protected SearchResultImpl
initSearchResult
(SearchContext searchContext, ElasticsearchSearchStrategy searchStrategy) protected boolean
isDisplayedField
(String fieldName) protected boolean
isResultFull
(SearchResultImpl searchResultImpl, SearchContext searchContext) objectNodeToMap
(com.fasterxml.jackson.databind.node.ObjectNode node) reloadIds
(MetaClass metaClass, Collection<Object> entityIds) protected ElasticsearchSearchStrategy
resolveSearchStrategy
(String searchStrategyName) resolveTargetIndexes
(SearchContext searchContext) search
(SearchContext searchContext) Performs search in search indexes according to providedSearchContext
and defaultSearchStrategy
.search
(SearchContext searchContext, String searchStrategyName) Performs search in search indexes according to providedSearchContext
andSearchStrategy
.searchNextPage
(SearchResult previousSearchResult) Performs search of next page according toSearchContext
andSearchResult
contained in providedSearchStrategy
related to previous page.
-
Field Details
-
GENERIC_MAP_TYPE_REF
-
client
protected final co.elastic.clients.elasticsearch.ElasticsearchClient client -
indexConfigurationManager
-
metadata
-
metadataTools
-
secureDataManager
-
instanceNameProvider
-
searchProperties
-
idSerialization
-
secureOperations
-
policyStore
-
searchStrategyManager
-
searchUtils
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
ElasticsearchEntitySearcher
public ElasticsearchEntitySearcher(co.elastic.clients.elasticsearch.ElasticsearchClient client, IndexConfigurationManager indexConfigurationManager, Metadata metadata, MetadataTools metadataTools, DataManager secureDataManager, InstanceNameProvider instanceNameProvider, SearchProperties searchProperties, IdSerialization idSerialization, SecureOperations secureOperations, PolicyStore policyStore, ElasticsearchSearchStrategyProvider searchStrategyManager, SearchUtils searchUtils)
-
-
Method Details
-
search
Description copied from interface:EntitySearcher
Performs search in search indexes according to providedSearchContext
and defaultSearchStrategy
.- Specified by:
search
in interfaceEntitySearcher
- Parameters:
searchContext
- runtime settings of specific search- Returns:
SearchResult
with found objects
-
search
Description copied from interface:EntitySearcher
Performs search in search indexes according to providedSearchContext
andSearchStrategy
.- Specified by:
search
in interfaceEntitySearcher
- Parameters:
searchContext
- runtime settings of specific searchsearchStrategyName
- the way incoming search text should be processed- Returns:
SearchResult
with found objects
-
searchNextPage
Description copied from interface:EntitySearcher
Performs search of next page according toSearchContext
andSearchResult
contained in providedSearchStrategy
related to previous page.- Specified by:
searchNextPage
in interfaceEntitySearcher
- Parameters:
previousSearchResult
-SearchResult
of previous page- Returns:
SearchResult
with found objects
-
initSearchResult
protected SearchResultImpl initSearchResult(SearchContext searchContext, ElasticsearchSearchStrategy searchStrategy) -
resolveTargetIndexes
-
resolveSearchStrategy
-
createRequest
protected co.elastic.clients.elasticsearch.core.SearchRequest createRequest(SearchContext searchContext, List<String> targetIndexes, ElasticsearchSearchStrategy searchStrategy, int offset) -
initRequest
-
applyPostStrategyRequestSettings
protected void applyPostStrategyRequestSettings(co.elastic.clients.elasticsearch.core.SearchRequest.Builder builder, SearchContext searchContext, int offset) -
configureHighlight
protected void configureHighlight(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder) -
groupHitsByEntity
-
fillSearchResult
protected void fillSearchResult(SearchResultImpl searchResultImpl, Map<MetaClass, List<co.elastic.clients.elasticsearch.core.search.Hit<com.fasterxml.jackson.databind.node.ObjectNode>>> hitsByEntityName) -
isResultFull
-
objectNodeToMap
-
createSearchResultEntry
protected SearchResultEntry createSearchResultEntry(String entityId, String instanceName, String entityName, co.elastic.clients.elasticsearch.core.search.Hit<com.fasterxml.jackson.databind.node.ObjectNode> searchHit) -
isDisplayedField
-
formatFieldName
-
reloadIds
-