Package de.cxp.ocs.elasticsearch.prodset
Class HeroProductHandler
- java.lang.Object
-
- de.cxp.ocs.elasticsearch.prodset.HeroProductHandler
-
public class HeroProductHandler extends Object
-
-
Constructor Summary
Constructors Constructor Description HeroProductHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidextendQuery(MasterVariantQuery searchQuery, InternalSearchParams internalParams)Extend MasterVariantQuery to inject the hero products and boost them to the top.static intextractSlices(org.elasticsearch.action.search.SearchResponse searchResponse, InternalSearchParams internalParams, SearchResult searchResult)Extract the hero products into separate ordered slices, that are attached to the searchResult.static intgetCorrectedMinHitCount(InternalSearchParams internalParams)Get minimum hitCount to accept the natural search to have matched anything.static StaticProductSet[]resolve(ProductSet[] productSets, Searcher searcher, SearchContext searchContext)Resolve the given product sets into static product sets.
-
-
-
Method Detail
-
resolve
public static StaticProductSet[] resolve(ProductSet[] productSets, Searcher searcher, SearchContext searchContext)
Resolve the given product sets into static product sets. For given static product sets, the specified IDs are verified. For dynamic product sets, the matching IDs are fetched.- Parameters:
productSets-searcher-searchContext-- Returns:
-
extendQuery
public static void extendQuery(MasterVariantQuery searchQuery, InternalSearchParams internalParams)
Extend MasterVariantQuery to inject the hero products and boost them to the top.- Parameters:
searchQuery-internalParams-
-
getCorrectedMinHitCount
public static int getCorrectedMinHitCount(InternalSearchParams internalParams)
Get minimum hitCount to accept the natural search to have matched anything. This is necessary to follow the query-relaxation chain until we have the original result, as if there wouldn't be any hero products.
- Parameters:
internalParams-- Returns:
- the expected minimum hit count
-
extractSlices
public static int extractSlices(org.elasticsearch.action.search.SearchResponse searchResponse, InternalSearchParams internalParams, SearchResult searchResult)Extract the hero products into separate ordered slices, that are attached to the searchResult.
In case the result was sorted or filtered, this method most likely won't extract slices anymore, because it expects them in the defined order at the top of the result.
- Parameters:
searchResponse-internalParams-searchResult-- Returns:
- fetchOffset: the index of the first hit, that is not a hero product
-
-