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
    Modifier and Type
    Field
    Description
    static final String
     
    protected static final String
    Deprecated.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultIndexerSearchService(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 Type
    Method
    Description
    protected com.broadleafcommerce.search.api.domain.FieldRef
    buildFieldRef(com.broadleafcommerce.search.api.domain.FieldDefinition field)
    Builds the FieldRef object based on a FieldDefinition
    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 by Indexable.
    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 by Indexable.
    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 and ContextInfo, if applicable.
    protected List<com.broadleafcommerce.search.api.domain.FieldDefinition>
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 interface IndexerSearchService<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 and ContextInfo, if applicable.
      Specified by:
      readFieldsByIndexableType in interface IndexerSearchService<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 by Indexable. Indexable is used to determine the IndexableType and, optionally, the Context Info (most importantly, the tenant based on the ContextStateAware, if applicable.
      Specified by:
      readFieldsByIndexable in interface IndexerSearchService<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 by Indexable. Indexable is used to determine the IndexableType and, optionally, the Context Info (most importantly, the tenant based on the ContextStateAware, if applicable.
      Specified by:
      readFieldsByIndexable in interface IndexerSearchService<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 interface IndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition>
      Parameters:
      indexableType - The indexable type to clear
    • readFieldsByIndexableType

      @NonNull protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexableType(String indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • hydrateBackReferences

      protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> hydrateBackReferences(@NonNull @NonNull List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions)
    • readFieldsByIndexableType

      @Deprecated protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> readFieldsByIndexableType(String indexableType)
      Deprecated.
    • buildSearchFieldUri

      protected URI buildSearchFieldUri(String indexableType)
    • 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 the FieldRef object based on a FieldDefinition
      Returns:
      The FieldRef object.
    • getWebClient

      protected org.springframework.web.reactive.function.client.WebClient getWebClient()
    • getSearchServiceEndpoint

      protected String getSearchServiceEndpoint()
    • getReadFieldsPath

      protected String 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

      public String getServiceClient()
      The service client to use when calling inventory services. Default is "indexerclient"
    • setServiceClient

      public void setServiceClient(String serviceClient)
      The service client to use when calling inventory services. Default is "indexerclient"