Class SandboxTrackableSolrQueryContributor
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor
-
- com.broadleafcommerce.search.provider.solr.SandboxTrackableSolrQueryContributor
-
- All Implemented Interfaces:
SolrQueryContributor,org.springframework.core.Ordered
public class SandboxTrackableSolrQueryContributor extends AbstractSolrQueryContributor
Add query filters to narrow query results down to the most specific Sandbox context provided.
-
-
Constructor Summary
Constructors Constructor Description SandboxTrackableSolrQueryContributor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcontributeInternal(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 providedsolrQuerywith some additional behavior.booleancontributeOnTypeAhead()protected StringfilterOnOtherSandboxes(com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Create a filter for sandboxes other than the current user's sandbox.protected StringfilterOnProductionSandbox()Create a filter for the production sandbox.protected StringfilterOnUserSandbox(com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Create a filter for the current user's sandbox.protected voidfilterOverriddenSandboxes(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Applies a filter to exclude documents for which more specific versions exist for this sandbox context.protected booleanshouldContribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Determines if this contributor should run.-
Methods inherited from class com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor
contribute
-
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
getOrder, isTypeAheadRequest
-
-
-
-
Method Detail
-
contributeInternal
protected void contributeInternal(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 class:AbstractSolrQueryContributorCustomize the providedsolrQuerywith some additional behavior.- Specified by:
contributeInternalin classAbstractSolrQueryContributor- Parameters:
solrQuery- The query to customizesearchRequest- The search query requestfieldDefinitions- The fields to perform the search onpage- Page information for page to retrieve for queryproperties- Additional properties for this querylocale- The locale of this searchcontext- The context information surrounding sandboxing/multitenant state
-
filterOnUserSandbox
protected String filterOnUserSandbox(com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Create a filter for the current user's sandbox.- Parameters:
context- The context information surrounding sandboxing/multitenant state- Returns:
- Filter for the current user's sandbox
-
filterOnOtherSandboxes
protected String filterOnOtherSandboxes(com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Create a filter for sandboxes other than the current user's sandbox.- Parameters:
context- The context information surrounding sandboxing/multitenant state- Returns:
- Filter for sandboxes other than the current user's sandbox
-
filterOnProductionSandbox
protected String filterOnProductionSandbox()
Create a filter for the production sandbox.- Returns:
- Filter for the production sandbox
-
filterOverriddenSandboxes
protected void filterOverriddenSandboxes(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Applies a filter to exclude documents for which more specific versions exist for this sandbox context.- Parameters:
solrQuery- Query to execute in Solrcontext- The context information surrounding sandboxing/multitenant state
-
shouldContribute
protected boolean shouldContribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Description copied from class:AbstractSolrQueryContributorDetermines if this contributor should run.- Specified by:
shouldContributein classAbstractSolrQueryContributor- Parameters:
solrQuery- The query to customizesearchRequest- The search query requestpage- Page information for page to retrieve for queryproperties- Additional properties for this query.context- The context information surrounding sandboxing/multitenant state- Returns:
- whether this contributor should run
-
contributeOnTypeAhead
public boolean contributeOnTypeAhead()
- Returns:
- Should this contributor be executed on TypeAhead requests?
-
-