Class AbstractCatalogTrackableSolrQueryContributor

java.lang.Object
com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor
com.broadleafcommerce.search.provider.solr.AbstractCatalogTrackableSolrQueryContributor
All Implemented Interfaces:
SolrQueryContributor, org.springframework.core.Ordered
Direct Known Subclasses:
CatalogTrackableSolrQueryContributor, SandboxTrackableSolrQueryContributor

public abstract class AbstractCatalogTrackableSolrQueryContributor extends AbstractSolrQueryContributor
  • Constructor Details

    • AbstractCatalogTrackableSolrQueryContributor

      public AbstractCatalogTrackableSolrQueryContributor()
  • Method Details

    • getDirectImplicitCatalogsForApplication

      protected Set<String> getDirectImplicitCatalogsForApplication(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean isIncludePending)
      Retrieve all directly-assigned catalogs visible for the current application. Does not include inherited catalogs. Optionally includes pending catalogs.
      Parameters:
      application - The application to retrieve visible direct catalogs from
      isIncludePending - Should pending catalogs be retrieved
      Returns:
      All directly assigned catalogs visible for the application context
    • getCatalogsForApplication

      protected Set<String> getCatalogsForApplication(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean isIncludePending)
      Retrieve all catalogs visible for the current application. Includes catalogs from inheritance lines, and optionally pending catalogs.
      Parameters:
      application - The application to retrieve visible catalogs from
      isIncludePending - Should pending catalogs be retrieved
      Returns:
      All catalogs visible for the application context
    • getCatalogs

      protected Set<String> getCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean includePending, Function<com.broadleafcommerce.data.tracking.core.tenant.domain.ApplicationCatalogRef,String> idGetter)
    • getArchivedCatalogs

      protected Map<String,Boolean> getArchivedCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application)
    • addPositiveExpressionModifier

      protected String addPositiveExpressionModifier(String solrFilter)

      As noted in this post, Solr requires that boolean expressions must have at least one 'positive' expression, otherwise it will match no results. This means that if we have a nested filter that contains only negated clauses, it won't work.

      Thus, we wrap such filters parentheses and add a match-all condition '*:*' at the beginning of the filter. This satisfies Solr's requirement for having at least one positive expression.

      Parameters:
      solrFilter - a filter that will be nested as part of a larger query, but itself is negated
      Returns:
      the provided filter, wrapped in parentheses with a '*:*' extra match-all filter