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.FieldRef
buildFieldRef
(com.broadleafcommerce.search.api.domain.FieldDefinition field) Builds theFieldRef
object based on aFieldDefinition
protected URI
buildSearchFieldUri
(String indexableType) void
clearCache
(com.broadleafcommerce.search.api.type.IndexableType indexableType) Clear any cached fields for the indexable type.protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
createContextFromIndexable
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) protected com.broadleafcommerce.common.extension.cache.CacheStateManager
protected org.springframework.http.HttpHeaders
getHeaders
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.fasterxml.jackson.databind.ObjectMapper
protected String
protected String
The service client to use when calling inventory services.protected com.broadleafcommerce.common.extension.TypeFactory
protected org.springframework.web.reactive.function.client.WebClient
protected 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) void
setServiceClient
(String serviceClient) The service client to use when calling inventory services.void
setTypeFactory
(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:IndexerSearchService
Returns a list of Search fields by IndexableType- Specified by:
readFieldsByIndexableType
in 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:IndexerSearchService
Returns a list of Search fields by IndexableType andContextInfo
, if applicable.- Specified by:
readFieldsByIndexableType
in 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:IndexerSearchService
Returns a list of Search fields byIndexable
. Indexable is used to determine theIndexableType
and, optionally, theContext Info (most importantly, the tenant
based on theContextStateAware
, if applicable.- Specified by:
readFieldsByIndexable
in 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:IndexerSearchService
Returns a list of Search fields byIndexable
. Indexable is used to determine theIndexableType
and, optionally, theContext Info (most importantly, the tenant
based on theContextStateAware
, if applicable.- Specified by:
readFieldsByIndexable
in 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:IndexerSearchService
Clear any cached fields for the indexable type.- Specified by:
clearCache
in 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 theFieldRef
object based on aFieldDefinition
- Returns:
- The
FieldRef
object.
-
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()