Gravatar for phani.av@gmail.com

Question by phani-abburi, Oct 1, 2018 3:39 AM

independent facets for Cartesian product data

Hi Team,

I am working on a products database that is built using a Cartesian product of multiple reference tables. This rendered all the products in the products table as just variants withe number closer to 700K records.

I am working on building a simple product model with all available variants as simple multi-valued field. This will reduce the products size from 700K to 4K which can easily fit with-in the limits of our Coveo cloud license.

Is it possible to create a multi-valued field in such a way that

grade1-size1-finish1; grade1-size1-finish2; grade2-size2-finish2

can result in individual facets for grade, size, finish and when grade1 is selected, size2 option is no longer available to user.

Or if user selects size2; grade1 and finish1 are removed for selection

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Oct 1, 2018 1:20 PM

Yes, that is exactly how facets are working out of the box with Coveo. As you select facet values, other facets refresh to display only values that can lead to refined search results. They would never let someone select a value that would lead to no results.

Let's assume you have 2 products

  • Product A
    • Variant 1: grade1-size1-finish1
    • Variant 2: grade1-size1-finish2
  • Product B
    • Variant 1: grade2-size2-finish2

The goal is to index only the product items, not the variant items.

On the product items, you define 3 multi-value facet fields: variantsGrade, variantsSize, and variantsFinish.

When you index the product items, you loop over the variants, read and keep the variant attribute values. At the end, you can remove duplicate values and set the field values to a semicolon separated values string.

Then on your search page, you add 3 facets: one for each of those fields. Make sure to enable the "is multi-value" option on your facet components.

Gravatar for phani.av@gmail.com

Comment by phani-abburi, Oct 1, 2018 3:41 PM

Thanks for the reply Jeff. While I get the general idea of what you are suggesting, I have question regarding variantsGrade. Grade, Size and Finish together form a group. If we break them into 3 multi-value facet fields how we can still maintain the dependability on one another?

Let me add an example to explain my understanding

  • Product A
    • Variant 1: grade1-size1-finish1
    • Variant 2: grade1-size1-finish3
    • Variant 3: grade3-size2-finish2
    • Variant 4: grade1-size1-finish2
  • Product B
    • Variant 1: grade2-size2-finish2
    • Variant 2: grade3-size1-finish1

After creating the product item for index,

  • Product A

    • Fields
      • variantsGrade: grade1; grade3
      • variantsSize: size1; size2
      • variantsFinish: finish1; finish2; finish3

  • Product B
    • Fields

      • variantsGrade: grade2; grade3
      • variantsSize: size1; size2
      • variantsFinish: finish1; finish2

On the search page I have 3 facets

  • Grade

    • grade1
    • grade2
    • grade3

  • Size

    • size1
    • size2

  • Finish

    • finish1
    • finish2
    • finish3

If user now selects grade1, what happens to Size and Finish facets? Will size2 disappear from the Size facet? What I am trying to solve is grade1-size2 is not a valid variant for Product A. However, with above approach, if we select grade1 and size2 values from Grade and Size facets, we are still seeing Product A in search results.

Any other strategies that we can use to solve the problem?

Ask a question