November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Why do you need to do distinct? Sounds like your index has duplicates.
Is your p.Id property decorated with [Id]?
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/8/DotNET-Client-API/Indexing/
Try that and then you won't get duplicates.
I think the requirement is that We have one to many relationship between product to variant. We want to search through all the variants but then display only the parent product on the results page.
E.g.
A product is a vaialable in red, green and yellow color. The color information is stored in the variant object. But if someone searches for yellow, result will be retruning the product object of yellow variantion.
Any help in this regard would be approcaiated.
I would include the variants on a product property.
You can target searching on enumerable properties as described here:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/8/DotNET-Client-API/Searching/Filtering/Complex-objects/
You could also assemble the variants' text you want searchable on a product string property.
Thanks for your input Johan,
Nice approach. How do we use the enumerable properties in .For("").InFields(....)?
Thanks,
Syed
Not sure but I recall Elasticsearch uses a dot syntax so something like this could work:
InFields(x => "product.variants.title", x => "product.variants.title")
I'd recommend creating a suitable property to get better control and shorter queries.
Something similar to this below
var query = people.DistinctBy(p => new { p.Id, p.Name });
Is there a way to do this in Episerver Find? Or override any method to make this work?