3

I am able to create faceted search using variants' attributes:

.plusFacets(facets -> facets.allVariants().attribute().ofString(sizeDescriptionAttribute).allTerms())

But I haven't managed to perform the same if I wanted to do it using products' attributes mixed with variants' attributes.

Is it possible to perform such operation?

Eder
  • 1,874
  • 17
  • 34
  • Hi @Eder, could you please elaborate more on what you are trying to do? What do you mean by products' vs. variants' attributes here? – Stefan Meissner Apr 01 '19 at 13:52

1 Answers1

3

You can use a -> {} syntax to build more complex process. In example:

.plusFacets(facets -> { 
    Object variants = facets.allVariants().attribute().ofString(sizeDescriptionAttribute).allTerms();
    Object products= searchForProducts(fecets);
    return mixOf(variants, products);
}).doMoreStuff();

So this whill give you a mix. You just need to implement missing methods or use similar syntax.