I created a term facet to show products that are currently on sale for a user this works well.
However I would like to combine this facet with additional none nested filters.
By default, TermsFacetFor does not allow to filter on none nested object. I would want the Facet to be a combination of the nested expression and anoter regular filter at the product level like FoodProduct.Name.Match(..)
query = query.TermsFacetFor<T, Price>(p => ((FoodProduct)(object)p).SearchPrices,
price => price.CustomerPricing.PriceCode,
priceFilter =>
(
priceFilter.CustomerPricing.PriceTypeId.Match(applicablePriceType) & priceFilter.CustomerPricing.PriceCode.Match(applicableSalesCode + "sale")
)
& priceFilter.UnitPrice.Amount.GreaterThan(0) //if a price is at zero ignore it
& priceFilter.ValidFrom.LessThan(utcNow)
& (!priceFilter.ValidUntil.Exists() | priceFilter.ValidUntil.GreaterThan(utcNow))
,
null,
filter);
Thus I created an overload for TermsForFacetFor as follow to created a AndFilter if any additional filter are required:
Hi,
I created a term facet to show products that are currently on sale for a user this works well.
However I would like to combine this facet with additional none nested filters.
By default, TermsFacetFor does not allow to filter on none nested object.
I would want the Facet to be a combination of the nested expression and anoter regular filter at the product level like FoodProduct.Name.Match(..)
Thus I created an overload for TermsForFacetFor as follow to created a AndFilter if any additional filter are required:
It always returns 0 results and I am unsure on my approch to resolve this issue.
I know, I could pre-filter outside of the facet but it is not what I want to achieve.
Generate Find Query For a Nested Facet that works: (Notice the facet_filter --> Nested)
Generate Find Query For a Nested Facet that does not work when trying to add a And: (Notice the facet_filter --> And)
The only solution I see is generating independant facet query with pre-filtering outside of the facet