Class DefaultIndexerSearchService
java.lang.Object
com.broadleafcommerce.search.index.core.service.DefaultIndexerSearchService
- All Implemented Interfaces:
IndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>
public class DefaultIndexerSearchService
extends Object
implements IndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultIndexerSearchService(org.springframework.web.reactive.function.client.WebClient webClient, String searchServiceEndpoint, String readFieldsPath, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.search.api.domain.FieldRefbuildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRefobject based on aFieldDefinitionprotected URIbuildSearchFieldUri(String indexableType) voidclearCache(com.broadleafcommerce.search.api.type.IndexableType indexableType) Clear any cached fields for the indexable type.protected com.broadleafcommerce.data.tracking.core.context.ContextInfocreateContextFromIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) protected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected org.springframework.http.HttpHeadersgetHeaders(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.fasterxml.jackson.databind.ObjectMapperprotected Stringprotected StringThe service client to use when calling inventory services.protected com.broadleafcommerce.common.extension.TypeFactoryprotected org.springframework.web.reactive.function.client.WebClientprotected List<com.broadleafcommerce.search.api.domain.FieldDefinition>hydrateBackReferences(@NonNull List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions) List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Returns a list of Search fields byIndexable.List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list of Search fields byIndexable.List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexableType(com.broadleafcommerce.search.api.type.IndexableType indexableType) Deprecated.List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexableType(com.broadleafcommerce.search.api.type.IndexableType indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list of Search fields by IndexableType andContextInfo, if applicable.protected List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexableType(String indexableType) Deprecated.protected List<com.broadleafcommerce.search.api.domain.FieldDefinition>readFieldsByIndexableType(String indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidsetServiceClient(String serviceClient) The service client to use when calling inventory services.voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Field Details
-
CACHE_BY_INDEXABLE_TYPE
- See Also:
-
CLIENT_REGISTRATION_ID
Deprecated.- See Also:
-
-
Constructor Details
-
DefaultIndexerSearchService
public DefaultIndexerSearchService(org.springframework.web.reactive.function.client.WebClient webClient, String searchServiceEndpoint, String readFieldsPath, com.fasterxml.jackson.databind.ObjectMapper objectMapper, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
-
Method Details
-
readFieldsByIndexableType
@Deprecated @Cacheable(cacheNames="indexCacheByIndexableType", sync=true) public List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexableType(com.broadleafcommerce.search.api.type.IndexableType indexableType) Deprecated.Description copied from interface:IndexerSearchServiceReturns a list of Search fields by IndexableType- Specified by:
readFieldsByIndexableTypein interfaceIndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>- Parameters:
indexableType- The indexable type- Returns:
- Search fields associated with the IndexableType
-
readFieldsByIndexableType
@NonNull public List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexableType(com.broadleafcommerce.search.api.type.IndexableType indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:IndexerSearchServiceReturns a list of Search fields by IndexableType andContextInfo, if applicable.- Specified by:
readFieldsByIndexableTypein interfaceIndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>- Parameters:
indexableType- The indexable type- Returns:
- Search fields associated with the IndexableType
-
readFieldsByIndexable
@NonNull public List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:IndexerSearchServiceReturns a list of Search fields byIndexable. Indexable is used to determine theIndexableTypeand, optionally, theContext Info (most importantly, the tenantbased on theContextStateAware, if applicable.- Specified by:
readFieldsByIndexablein interfaceIndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>- Returns:
-
readFieldsByIndexable
@NonNull public List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Description copied from interface:IndexerSearchServiceReturns a list of Search fields byIndexable. Indexable is used to determine theIndexableTypeand, optionally, theContext Info (most importantly, the tenantbased on theContextStateAware, if applicable.- Specified by:
readFieldsByIndexablein interfaceIndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>- Returns:
-
clearCache
@CacheEvict("indexCacheByIndexableType") public void clearCache(com.broadleafcommerce.search.api.type.IndexableType indexableType) Description copied from interface:IndexerSearchServiceClear any cached fields for the indexable type.- Specified by:
clearCachein interfaceIndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>- Parameters:
indexableType- The indexable type to clear
-
readFieldsByIndexableType
-
hydrateBackReferences
-
readFieldsByIndexableType
@Deprecated protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexableType(String indexableType) Deprecated. -
buildSearchFieldUri
-
createContextFromIndexable
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo createContextFromIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) -
getHeaders
protected org.springframework.http.HttpHeaders getHeaders(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildFieldRef
protected com.broadleafcommerce.search.api.domain.FieldRef buildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRefobject based on aFieldDefinition- Returns:
- The
FieldRefobject.
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
getSearchServiceEndpoint
-
getReadFieldsPath
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getCacheStateManager
protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
getServiceClient
The service client to use when calling inventory services. Default is "indexerclient" -
setServiceClient
The service client to use when calling inventory services. Default is "indexerclient"
-
getServiceClient()