public class BoostSearchQueryPopulator<FACET_SEARCH_CONFIG_TYPE,INDEXED_TYPE_TYPE,INDEXED_PROPERTY_TYPE,INDEXED_TYPE_SORT_TYPE> extends Object
setMaxHeroProductBoost(double). For each hero product down the list it will decrement the boost values by
the value defined in setHeroProductBoostDecrement(double). This populator should be one of the last
populators to kick in.| Constructor and Description |
|---|
BoostSearchQueryPopulator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBoostQueryTerm(SearchQuery searchQuery,
String categoryCode,
String fieldName,
String fieldValue,
double boostFactor)
Appends actual boost term to the Solr search query via OR expression.
|
protected void |
addConfiguredProductBoosts(SearchQuery searchQuery,
IndexedType indexedType,
String categoryCode,
FacetSearchConfig facetSearchConfig)
Adds boost terms for all configured product boosts in a category.
|
protected void |
addHeroProductBoosts(SearchQuery searchQuery,
String categoryCode)
Adds boost terms for Hero product boosts.
|
protected Collection<SolrBoostRuleModel> |
getBoostRules(IndexedType indexedType,
String categoryCode,
FacetSearchConfig facetSearchConfig) |
protected String |
getCategoryFilterTermKey() |
protected String |
getSelectedCategory(SearchQueryPageableData<SolrSearchQueryData> source)
Returns the selected category as per given
SearchQueryPageableData. |
protected String |
getSort(SearchQueryPageableData<SolrSearchQueryData> source)
Return the currently selected sort order.
|
protected boolean |
isBoostDisabled(IndexedTypeSort indexedTypeSort)
Checks Sort configuration for useBoost flag.
|
void |
populate(SearchQueryPageableData<SolrSearchQueryData> source,
SolrSearchRequest<FACET_SEARCH_CONFIG_TYPE,INDEXED_TYPE_TYPE,INDEXED_PROPERTY_TYPE,SearchQuery,INDEXED_TYPE_SORT_TYPE> target)
Add boost expressions as explained in class's JavaDoc.
|
void |
setBoostService(BoostService boostService) |
void |
setCategoryFilterTermKey(String categoryFilterTermKey)
The key in the filter terms (aka facets) that denotes the category.
|
void |
setCategoryService(CategoryService categoryService) |
void |
setHeroProductBoostDecrement(double heroProductBoostDecrement)
The value we subsrtract from the boost value for each hero product down the list.
|
void |
setHeroProductFacade(HeroProductFacade heroProductFacade) |
void |
setMaxHeroProductBoost(double maxHeroProductBoost)
The boost for the hero product on the top position.
|
void |
setSolrQueryOperatorTranslator(SolrQueryOperatorTranslator solrQueryOperatorTranslator) |
public void populate(SearchQueryPageableData<SolrSearchQueryData> source, SolrSearchRequest<FACET_SEARCH_CONFIG_TYPE,INDEXED_TYPE_TYPE,INDEXED_PROPERTY_TYPE,SearchQuery,INDEXED_TYPE_SORT_TYPE> target) throws ConversionException
ConversionExceptionprotected boolean isBoostDisabled(IndexedTypeSort indexedTypeSort)
indexedTypeSort - protected void addHeroProductBoosts(SearchQuery searchQuery, String categoryCode)
categoryCode - the categorysearchQuery - the searchQueryprotected void addConfiguredProductBoosts(SearchQuery searchQuery, IndexedType indexedType, String categoryCode, FacetSearchConfig facetSearchConfig)
BoostService. Supported boost operators are translated into solr query by
SolrQueryOperatorTranslator.searchQuery - the searchQueryindexedType - the indexedTypecategoryCode - the categoryfacetSearchConfig - the facetSearchConfigprotected Collection<SolrBoostRuleModel> getBoostRules(IndexedType indexedType, String categoryCode, FacetSearchConfig facetSearchConfig)
protected void addBoostQueryTerm(SearchQuery searchQuery, String categoryCode, String fieldName, String fieldValue, double boostFactor)
searchQuery - the SearchQueryfieldName - the indexed property field to boostfieldValue - the field value to search forboostFactor - the boost factor to applyprotected String getSort(SearchQueryPageableData<SolrSearchQueryData> source)
SearchQueryData that represents the
current search state, then we look it up in PageableData that denotes what has been selected by the user
on the frontend.source - the pageable data sourceprotected String getSelectedCategory(SearchQueryPageableData<SolrSearchQueryData> source)
SearchQueryPageableData. First this method will check if
there's a value for a filter term with the key as returned by getCategoryFilterTermKey(). There will be
such a value if the user has selected a category facet value. If there is no such filter term this method will
return the selected categegory code (i.e. the one the user has clicked on in the top-level navigation.source - the current search query statepublic void setCategoryFilterTermKey(String categoryFilterTermKey)
public void setMaxHeroProductBoost(double maxHeroProductBoost)
public void setHeroProductBoostDecrement(double heroProductBoostDecrement)
protected String getCategoryFilterTermKey()
public void setHeroProductFacade(HeroProductFacade heroProductFacade)
public void setCategoryService(CategoryService categoryService)
public void setBoostService(BoostService boostService)
public void setSolrQueryOperatorTranslator(SolrQueryOperatorTranslator solrQueryOperatorTranslator)
Copyright © 2017 SAP SE. All Rights Reserved.