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
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddPositiveExpressionModifier(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.getArchivedCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application) getCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean includePending, Function<com.broadleafcommerce.data.tracking.core.tenant.domain.ApplicationCatalogRef, String> idGetter) getCatalogsForApplication(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean isIncludePending) Retrieve all catalogs visible for the current application.getDirectImplicitCatalogsForApplication(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, boolean isIncludePending) Retrieve all directly-assigned catalogs visible for the current application.Methods inherited from class com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor
contribute, contributeInternal, shouldContributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.search.provider.solr.SolrQueryContributor
contributeOnTypeAhead, getOrder, isTypeAheadRequest
-
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 fromisIncludePending- 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 fromisIncludePending- Should pending catalogs be retrieved- Returns:
- All catalogs visible for the application context
-
getCatalogs
-
getArchivedCatalogs
-
addPositiveExpressionModifier
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
-