Class SearchClient

java.lang.Object
de.cxp.ocs.client.SearchClient
All Implemented Interfaces:
SearchService

public class SearchClient extends Object implements SearchService
  • Constructor Details

    • SearchClient

      public SearchClient(String endpointUrl, Consumer<feign.Feign.Builder> feignConfigurer)
      With this constructor the Feign::Builder can be configured.
      Parameters:
      endpointUrl -
      feignConfigurer -
    • SearchClient

      public SearchClient(String endpointUrl)
      Initializes the SearchClient with the given endpointUrl and the default Jackson encoder. If this constructor is not used, Jackson is not necessary on the classpath. Instead take care of a working Decoder.
      Parameters:
      endpointUrl -
  • Method Details

    • getTenants

      public String[] getTenants()
      Specified by:
      getTenants in interface SearchService
    • search

      public SearchResult search(String tenant, SearchQuery searchParams, Map<String,String> filters) throws Exception
      Description copied from interface: SearchService
      Search the index using the given searchQuery. Each tenant can have its own configuration. Different tenants may still use the same indexes. This is defined by the underlying configuration.
      Specified by:
      search in interface SearchService
      Parameters:
      tenant - the name that correlates to the index configuration
      searchParams - the user's search terms
      filters - Any other parameters are used as filters. They are validated according to the actual data and configuration. Each filter can have multiple values, separated by comma. Commas inside the values have to be double-URL encoded. Depending on the configured backend type these values are used differently. Examples:
      • brand=adidas
      • brand=adidas,nike (products from adidas OR nike are shown)
      • category=men,shoes,sneaker (if category would be configured as path, these values are used for hierarchical filtering)
      • price=10,99.99 (if price is configured as numeric field, these values are used as range filters)
      • color=red,black (if that field is configured to be used for "exclusive filtering" only products would be shown that are available in red AND black)
      • optional for the future also negations could be supported, e.g. color=red,!black
      Returns:
      the result of that search request
      Throws:
      Exception -
      • if tenant can't be accessed
      • if according index does not exist
    • arrangedSearch

      public SearchResult arrangedSearch(String tenant, ArrangedSearchQuery searchQuery) throws Exception
      Specified by:
      arrangedSearch in interface SearchService
      Throws:
      Exception
    • getDocument

      public Document getDocument(String tenant, String docId) throws Exception
      Specified by:
      getDocument in interface SearchService
      Throws:
      Exception