Class StartsWithElasticsearchSearchStrategy
java.lang.Object
io.jmix.search.searching.impl.AbstractSearchStrategy
io.jmix.searchelasticsearch.searching.strategy.impl.StartsWithElasticsearchSearchStrategy
- All Implemented Interfaces:
SearchStrategy
,ElasticsearchSearchStrategy
@Component("search_StartsWithElasticsearchSearchStrategy")
public class StartsWithElasticsearchSearchStrategy
extends AbstractSearchStrategy
implements ElasticsearchSearchStrategy
Class that encapsulates logic of
SearchStrategy
that searches documents by prefix.-
Field Summary
Modifier and TypeFieldDescriptionprotected final IndexConfigurationManager
protected final Metadata
protected final PolicyStore
protected final SearchProperties
protected final SearchUtils
protected final SecureOperations
-
Constructor Summary
ConstructorDescriptionStartsWithElasticsearchSearchStrategy
(IndexConfigurationManager indexConfigurationManager, SearchProperties searchProperties, SecureOperations secureOperations, PolicyStore policyStore, Metadata metadata, SearchUtils searchUtils) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configureRequest
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext) Configures ElasticsearchSearchRequest
.protected void
configureTermsQuery
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext) protected void
configureWildcardQuery
(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext, Set<String> effectiveFieldsToSearch) getName()
Provides the name of this search strategy.protected boolean
isSearchTermExceedMaxPrefixSize
(String searchText, int maxPrefixSize) Methods inherited from class io.jmix.search.searching.impl.AbstractSearchStrategy
toString
-
Field Details
-
indexConfigurationManager
-
searchProperties
-
secureOperations
-
policyStore
-
metadata
-
searchUtils
-
-
Constructor Details
-
StartsWithElasticsearchSearchStrategy
public StartsWithElasticsearchSearchStrategy(IndexConfigurationManager indexConfigurationManager, SearchProperties searchProperties, SecureOperations secureOperations, PolicyStore policyStore, Metadata metadata, SearchUtils searchUtils)
-
-
Method Details
-
getName
Description copied from interface:SearchStrategy
Provides the name of this search strategy. Name should be unique among all search strategies in application.- Specified by:
getName
in interfaceSearchStrategy
- Returns:
- name
-
configureRequest
public void configureRequest(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext) Description copied from interface:ElasticsearchSearchStrategy
Configures ElasticsearchSearchRequest
.The main step - create appropriate query based on provided
SearchContext
and set it to request.Configuration of another request parameters is optional.
Highlighting, size and offset shouldn't be configured here - these parameters will be overwritten.
- Specified by:
configureRequest
in interfaceElasticsearchSearchStrategy
- Parameters:
requestBuilder
- allows to configure search requestsearchContext
- contains details about search being performed
-
configureTermsQuery
protected void configureTermsQuery(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext) -
configureWildcardQuery
protected void configureWildcardQuery(co.elastic.clients.elasticsearch.core.SearchRequest.Builder requestBuilder, SearchContext searchContext, Set<String> effectiveFieldsToSearch) -
isSearchTermExceedMaxPrefixSize
-