Tutorial: Create a Multi-Dimension Facet

We now want to determine the number of items sold by city and by product color. City and color will be the two dimensions of a new facet called units_sold.

A multi-dimension facet uses the categories generated by two or more facets (any type, virtual or not, but one-dimensional only) to create its categories. Let us use a multi-dimension facet here that is calculated at search-time, meaning it is calculated for the search results only.

By contrast, creating this as an index field would generate a huge number of values since it would be calculated for all documents: number of field values = number of cities * number of colors, for all documents in the index.

Note: The widget allowing the display of multi-dimension facets is only available in Mashup Builder Premium.

This task shows you how to:

Add the units_sold Multi-Dimension Facet

  1. In the Administration Console, select Search > Search Logics > sl0.
  2. Click Add facet, and specify the following:
    1. In Name, type units_sold.
    2. In Type, select Multi-Dimension.
  3. Specify the following Dimensions:
    1. In the first facet, select sales_color.
    2. In the second facet, select sales_store_city.
  4. Expand Aggregations, and specify the following:
    1. In Id, type units_sold.
    2. In Type, select SUM.
    3. In Expression, enter sales_quantity.
  5. Click Apply.

Configure the Display of the Multi-Dimension Facet

  1. In Mashup Builder, select the /search page, and then select the Design view.
  2. From the Widgets panel, expand Tables and drag 2D Data Table to the page so it is immediately above the Data Table widget.
  3. Click the 2D Data Table widget header and specify the following:
    1. In Widget Title, type Unit Sold by Country and Color.
    2. In Facet id, select units_sold (from the contextual menu on the left).

    Note: If you do not see this facet on this list, click the "Reload" icon at the top of the list.

  4. In Aggregations, specify the following:
    1. In Aggregation, replace the default count aggregation by units_sold.
    2. In Label, type Units Sold.
  5. Click Apply.

View Your Changes

  1. Go to the Mashup UI, and refresh the search page.
  2. Search for shirt

    A two-dimensional table now displays in the search results.



  3. When you click a value within the table, for example red for Rio de Janeiro, this narrows the search results on both dimensions.