Drupal Facet Mapping Examples: Online Shop, News Site and Course Catalogue

Drupal

Three sample setups for the Facet Mapping tab of the Opensolr Search module. Your field names will differ; the choice of Solr Type and widget is what carries over.

01 · How a mapping works

Pick the Drupal Field, keep or change the Solr Field Name, check the Solr Type, write the Display Label, then click Save configuration.

Text uses String, decimal numbers Float, whole numbers Integer, dates Date. A Drupal field that holds several values needs the multi-value type: the form refuses a single-value type for it.

The field lands in your index as its name plus the type ending, for example brand_s. Index your content again, then turn the facet on in Facet Configuration and pick its widget.

The tabs in detail: Facet Mapping and Facet Configuration.

02 · Online shop

Drupal fieldSolr Field NameSolr TypeWidget
Brand (one value)brandString (single)List
Color (taxonomy, several)colorString (multi-value)List
Size (list, several)sizeString (multi-value)List
Rating (decimal)ratingFloat (single)Min/Max slider

With Drupal Commerce, Data Ingestion sends the price and currency of each product without a mapping.

03 · News site

Drupal fieldSolr Field NameSolr TypeWidget
Section (taxonomy, one)sectionString (single)List
Tags (taxonomy, several)tagsString (multi-value)List
Published datepublishedDate (single)Date range picker
Video length in secondsdurationInteger (single)Duration slider (h:mm:ss)

04 · Course catalogue

Drupal fieldSolr Field NameSolr TypeWidget
Department (taxonomy, one)departmentString (single)List
Level (list, one)levelString (single)List
Year (whole number)yearInteger (single)Min/Max slider
Format (list, several)formatString (multi-value)List

For a nested taxonomy, such as Subject and then Topic, see Hierarchical categories.