Facets

With the Facet module, site builders can easily create and manage facets of search interfaces. You can see this a lot on webshops.

Facets

We will explain the steps here by means of an example.

Preparation:

1. Module (s):
Activate these module(s):

Facets
Search Api (We choose to activate Database Search Defaults It has the advantage that a database server and index are being made.)

 

    install search api

    2. Taxonomy:
    Create 2 new word lists:

    Brand:
    Type: and add the necessary terms.
    3. Content type:
    Create a new content type Auto with the following fields:

    Title:
    Body:
    Image:
    Brand:
    Field type: Reference to a taxonomy term (glossary: Brand)
    Type:
    Field type: Reference to a taxonomy term (glossary: Type)
    Price:
    Field type: Number (integer)

    inhoudstype auto

    Add  content

    4. Settings:
    Via Management - Settings - Search and metadata you can make the necessary settings for Search Api.

    Search Api:
    thanks to the activation of Database Search Defaults, a Database server and an index are already available. If you have not done this then you must first add it.

    search api facets

    Change or add to Index:

    Edit tab: look under Data source or Content is checked
    Fields tab: add the Brand and Type fields via the add fields button

      • Merk:
      • Veld Merk
      • Type:
      • veld type
      • Resultaat:
      • velden
    • Tabblad Processors: Look for Processor configuration Enable all settings

    • Save everything changes and then on the Display tab you can now index (so you do not have to wait for the next cron).

    indexeren

      5. View:


      Make a new view Auto's choose at the configuration fot Index Default content index

      and choose at the page configuration for unformatted list with fields.

      instellingen

      add fields Title en Afbeelding 

      velden toeveoegen

      Preview

      voorbeeldweergave

      Make a menu link

      menulink

      add class for CSS

      rijklasse

      preview

      resultaat

       

      6. Facets:

      At search and metadata - Zoeken en metadata , add facets.

      add facet

      Settings

      • Facet source:
        • View "naam van uw view", display Page
      • Field:
        • Merk >> Taxonomieterm >> Naam (field_merk:entity:name)

      facet merk

      • Configuration:
        • Widget: List of check boxes
        • Settings: activateShow the amount of results 
        • Operator: AND

       

      Add new facet type.

      Settings

      • Facet source:
        • View "naam van uw view", display Page
      • Field:
        • Type>> Taxonomieterm >> Naam (field_type:entity:name)

       

      • Settings:
        • Widget: List of check boxes
        • Settings: activateShow the amount of results
        • Facet settings: activate
          • Enable condition
          • Check whether the facet is selected / not empty.
        • Operator: OR


       

      These facets are now blocks. Put them in a block region.

      blokken sidebar

      Preview

      overzicht merk

      Selecting a cartype activates the type facet.

      overzicht