Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
I haven't tried it, but perhaps
.Filter(x => x.Prices(), p => p.Amount > 0 ))
might work
The code I wrote is following the path Quan Mai suggest:
.Filter(x => !x.Prices().MatchItem(p => p.MatchTypeHierarchy(typeof(Price))))
The thing is, that is "pure" Elasticsearch query, it is possible to test the "array" and not by querying a sub-item.
I would like to use Episerver Search & Navigation -- Find -- to search for all variants that does have any prices. I am not sure how to build the correct filter to do this.
Code so far:
var itemsWithNoPrices = _client.Search<VariationContent>().Filter(x => x.Prices() ????? ) // <-- how to construct?.Select(x => x.Code).GetResult();"Prices" are added by default via "nested conventions", and are of type IEnumerable<Price>. When a price exists I can see that the json in Find contains:
"Prices$$nested": [{"MinQuantity$$number": 0,"CustomerPricing": {"PriceCode$$string": "","PriceTypeId": 0,"$type": "Mediachase.Commerce.Pricing.CustomerPricing, Mediachase.Commerce"},"UnitPrice": {"Currency": {"CurrencyCode$$string": "USD"},"Amount$$number": "316.000000000","$type": "Mediachase.Commerce.Money, Mediachase.Commerce"},And when no prices exists it looks like this:
"Prices$$nested": [],How should my filter be constructed? Or phrased differently: how do I build a filter for nested queries as "Prices$$nested"?
--
The reason I want to use Find and not using traversing is, that the catalog contains more than 200.000 variants and Elastic search is quite fast for this.