Can I create faceted searches in CT using product attributes?… here is a solution to the problem.
Can I create faceted searches in CT using product attributes?
I was able to create a faceted search using the properties of the variation:
.plusFacets(facets -> facets.allVariants().attribute().ofString(sizeDescriptionAttribute).allTerms())
But if I want to mix product attributes with variation attributes, I haven’t managed to do the same yet.
Is it possible to do this?
Solution
You can build more complex processes using the a -> {}
syntax. For example:
.plusFacets(facets -> {
Object variants = facets.allVariants().attribute().ofString(sizeDescriptionAttribute).allTerms();
Object products= searchForProducts(fecets);
return mixOf(variants, products);
}).doMoreStuff();
So this will give you a combination. You just need to implement the missing method or use a similar syntax.