Class SearchFacetUtils<F extends com.broadleafcommerce.search.api.domain.Facet>
java.lang.Object
com.broadleafcommerce.search.core.service.facet.SearchFacetUtils<F>
public class SearchFacetUtils<F extends com.broadleafcommerce.search.api.domain.Facet>
extends Object
Utilities for working with
Facets
.- Since:
- 2.1.0-GA
- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorsConstructorDescriptionSearchFacetUtils
(SettingsFacetGroupService<com.broadleafcommerce.search.api.domain.SettingsFacetGroup> settingsFacetGroupService, FacetGroupService<com.broadleafcommerce.search.api.domain.FacetGroup> facetGroupService, FacetGroupFacetService<com.broadleafcommerce.search.api.domain.FacetGroupFacet> facetGroupFacetService, FacetService<F> facetService, com.broadleafcommerce.search.autoconfigure.SearchSettingsProperties searchSettingsProperties, SearchSettingsUtils searchSettingsUtils) -
Method Summary
Modifier and TypeMethodDescriptiondetermineAvailableFacetsForFacetGroup
(com.broadleafcommerce.search.api.domain.SettingsFacetGroup settingsFacetGroup, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) determineFacetsForSearchRequest
(@NonNull List<? extends com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, String indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected Optional<com.broadleafcommerce.search.api.domain.SettingsFacetGroup>
determineSettingsFacetGroup
(com.broadleafcommerce.search.api.domain.SearchSettings searchSettings, String indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected FacetGroupFacetService<com.broadleafcommerce.search.api.domain.FacetGroupFacet>
protected FacetGroupService<com.broadleafcommerce.search.api.domain.FacetGroup>
protected FacetService<F>
protected com.broadleafcommerce.search.autoconfigure.SearchSettingsProperties
protected SearchSettingsUtils
protected SettingsFacetGroupService<com.broadleafcommerce.search.api.domain.SettingsFacetGroup>
void
hydrateFacetsOntoFields
(@NonNull com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, @NonNull List<? extends com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) HydratesFacets
onto the providedFieldDefinitions
for the givenSearchRequest
.
-
Constructor Details
-
SearchFacetUtils
public SearchFacetUtils(SettingsFacetGroupService<com.broadleafcommerce.search.api.domain.SettingsFacetGroup> settingsFacetGroupService, FacetGroupService<com.broadleafcommerce.search.api.domain.FacetGroup> facetGroupService, FacetGroupFacetService<com.broadleafcommerce.search.api.domain.FacetGroupFacet> facetGroupFacetService, FacetService<F> facetService, com.broadleafcommerce.search.autoconfigure.SearchSettingsProperties searchSettingsProperties, SearchSettingsUtils searchSettingsUtils)
-
-
Method Details
-
hydrateFacetsOntoFields
public void hydrateFacetsOntoFields(@NonNull @NonNull com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, @NonNull @NonNull List<? extends com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) HydratesFacets
onto the providedFieldDefinitions
for the givenSearchRequest
. IfSearchSettings are enabled
, then this will look up theSearchSettings
first to find the appropriate settings for the application or tenant in context. Then it will clear all facet related fields on the field definitions and re-hydrate them based on the facets configured. Otherwise, it will simply pass the field definitions through as they already have the appropriate information.This will use a copy of the given
ContextInfo
that hasContextInfo.isIgnoreCatalogNarrowing()
set to true when reading search settings and related domain since the Catalog ID on the request will be for the indexable type being queried on not the Search Group the settings belong to.- Parameters:
searchRequest
- Incoming requestfieldDefinitions
- List of resolvedFieldDefinitions
appropriate for the indexable type.originalContext
- Additional sandbox and multitenant info.
-
determineFacetsForSearchRequest
-
determineAvailableFacetsForFacetGroup
-
determineSettingsFacetGroup
-
getSettingsFacetGroupService
protected SettingsFacetGroupService<com.broadleafcommerce.search.api.domain.SettingsFacetGroup> getSettingsFacetGroupService() -
getFacetGroupService
protected FacetGroupService<com.broadleafcommerce.search.api.domain.FacetGroup> getFacetGroupService() -
getFacetGroupFacetService
protected FacetGroupFacetService<com.broadleafcommerce.search.api.domain.FacetGroupFacet> getFacetGroupFacetService() -
getFacetService
-
getSearchSettingsProperties
protected com.broadleafcommerce.search.autoconfigure.SearchSettingsProperties getSearchSettingsProperties() -
getSearchSettingsUtils
-