Class RSQLSolrQueryContributor

java.lang.Object
com.broadleafcommerce.search.provider.solr.RSQLSolrQueryContributor
All Implemented Interfaces:
SolrQueryContributor, org.springframework.core.Ordered

public class RSQLSolrQueryContributor extends Object implements SolrQueryContributor
This contributor converts RSQL parameters into filter queries that solr understands.

This is also used for type-ahead requests.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
    This is the default name of the Category filter.
    protected static final int
     

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    RSQLSolrQueryContributor(SolrRSQLFilterBuilder rsqlFilterBuilder, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    contribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, String locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Customize the provided solrQuery with some additional behavior.
    boolean
     
    protected String
    getCategoryProductMembershipFilter(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, String locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>
     
    protected com.broadleafcommerce.search.core.service.locale.LocaleHelper
     
    int
    Default Spring Bean ordering.
     
    void
    setLocaleHelper(com.broadleafcommerce.search.core.service.locale.LocaleHelper localeHelper)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.search.provider.solr.SolrQueryContributor

    isTypeAheadRequest
  • Field Details

    • DEFAULT_PRECEDENCE

      protected static final int DEFAULT_PRECEDENCE
      See Also:
    • CATEGORY_IDS_FILTER_NAME

      protected static final String CATEGORY_IDS_FILTER_NAME
      This is the default name of the Category filter.
      See Also:
  • Constructor Details

    • RSQLSolrQueryContributor

      public RSQLSolrQueryContributor(SolrRSQLFilterBuilder rsqlFilterBuilder, @NonNull com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser)
  • Method Details

    • contribute

      public void contribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable String locale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: SolrQueryContributor
      Customize the provided solrQuery with some additional behavior.
      Specified by:
      contribute in interface SolrQueryContributor
      Parameters:
      solrQuery - The query to customize
      searchRequest - The search query request
      fieldDefinitions - The fields to perform the search on
      page - Page information for page to retrieve for query
      properties - Additional properties for this search
      locale - (optional) the locale of the query
      context - The context information surrounding sandboxing/multitenant state
    • getCategoryProductMembershipFilter

      @Nullable protected String getCategoryProductMembershipFilter(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, @Nullable String locale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • getOrder

      public int getOrder()
      Description copied from interface: SolrQueryContributor
      Default Spring Bean ordering.
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Specified by:
      getOrder in interface SolrQueryContributor
    • contributeOnTypeAhead

      public boolean contributeOnTypeAhead()
      Specified by:
      contributeOnTypeAhead in interface SolrQueryContributor
      Returns:
      Should this contributor be executed on TypeAhead requests?
    • getRsqlFilterBuilder

      protected SolrRSQLFilterBuilder getRsqlFilterBuilder()
    • getFilterParser

      @NonNull protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getFilterParser()
    • getLocaleHelper

      protected com.broadleafcommerce.search.core.service.locale.LocaleHelper getLocaleHelper()
    • setLocaleHelper

      @Autowired public void setLocaleHelper(com.broadleafcommerce.search.core.service.locale.LocaleHelper localeHelper)