LogoLogo
  • GovCMS8 Site Building Training Manual
  • Contributing and Feedback Guide
  • Software and module requirements
  • UNIT 1: FUNCTIONAL ANALYSIS
    • Overview
    • Layout of a GovCMS page
    • Regions in GovCMS
    • Planning your site
    • About our client
    • Understanding requirements
    • Audience analysis
    • User (visitor) personas
    • Define user stories
    • Roles and Permissions
      • Exercise 1.1: Configure account settings
    • Blocks in GovCMS
      • Exercise 1.3: Place Welcome message block
    • Site navigation
    • Footers
      • Exercise 1.4: Build the related links menu
      • Exercise 1.5: Assign the related links menu block to a region
      • Exercise 1.6: Configure the related links menu block
      • Exercise 1.7: Rearrange the main menu
    • Theme settings
      • Exercise 1.8: Change the logo
      • Exercise 1.9: Create a friendly error page
    • Unit 1 Summary
  • UNIT 2: DESIGNING AND PLANNING CONTENT
    • Designing and planning content
      • Exercise 2.1: Compare content types
    • Planning your site structure
    • Planning data entry and display
    • Discussion
      • Exercise 2.2: Design a content type in minutes
      • Exercise 2.3: Create a content type
    • Add and configure fields
      • Exercise 2.5: Modify an existing field
      • Exercise 2.6: Add a custom text field
      • Exercise 2.7: Review the field list report
    • Manage form display
      • Exercise 2.8: Testing content types
    • Unit 2 Summary
  • UNIT 3: MANAGE MEDIA
    • Manage Media
    • Customise image display with image styles
    • Review configuration of image media display
      • Exercise 3.1: Example use of image styles
      • Exercise 3.2: Add and configure a media field
      • Exercise 3.3 (Challenge): Change image size
    • Unit 3 Summary
  • UNIT 4: TAXONOMY - CATEGORISING CONTENT
    • Taxonomy - Categorising content
      • Exercise 4.1: Add new Vocabulary
      • Exercise 4.2: Add Taxonomy field to content types
    • About input options
      • Exercise 4.3: Add fields to content types
      • Exercise 4.4: Test the new vocuabulary
    • Editorial considerations
    • Prepare documentation for new staff onboarding
    • Content creation forms
    • Unit 4 Summary
  • UNIT 5: TEXT FORMATS AND RICH TEXT
    • Text formats and rich text
      • Exercise 5.1 (Optional): Set up the Rich Text editor
      • Exercise 5.2 (Challenge): Create a new text format
    • About cross-site scripting
    • Text formats
    • Unit 5 Summary
  • UNIT 6: CONTENT LISTING WITH VIEWS
    • Content listing with Views
      • Exercise 6.1: Build the employment news view
    • Views - Part 2
      • Exercise 6.3: A customised News and Media page
      • Exercise 6.4: Reuse a Views template
    • Related content by term
      • Exercise 6.5: Make a list of States/Territories block
      • Exercise 6.6: Build the related content block
      • Exercise 6.7: Configure data field and Event content type
      • Exercise 6.8 (Challenge): Extend Content type
      • Exercise 6.9: Modify an event listing for future dates
    • Customize the content administration experience
      • Exercise 6.10: Administration with View bulk operations
    • Unit 6 Summary
  • UNIT 7: URL ALIASES
    • URL Aliases
      • Exercise 7.1: URL aliases - Patterns
    • URL Redirects
      • Exercise 7.2: Configure redirects
      • Exercise 7.3: Breadcrumbs
    • Menu check
    • Unit 7 Summary
  • UNIT 8: SITE BUILDING EXERCISES
    • Site building exercices workshop
    • Extend content types with new fields
      • Exercise 8.1: Add an external link field
    • Agency reference link
      • Exercise 8.2: Create Agency References
    • Job list dropdown filter
      • Exercise 8.3: Configure the job listing
      • Exercise 8.4: Agency logo in Job Posting view
      • Exercise 8.5: Challenge exercises
    • Discussion
    • Views contextual filters
      • Exercise 8.6: Add About author block to News article
    • Further discussion and exercices
    • Employee list and custom profiles
      • Exercise 8.7: Set up profile fields
      • Exercise 8.8: Create a list of users
      • Exercise 8.9: Edit the existing view to filter out roles
      • Exercise 8.10: Create a custom layout
      • Exercise 8.11 (Challenge): An image gallery
    • Unit Summary
    • Discussion
  • UNIT 9: SEARCH AND RELATED CONTENT
    • Search and related content
      • Exercise 9.1: Explore the default search
      • Exercise 9.2: Set up Job posting content type display in global search
      • Exercise 9.3: Create new search page with Search API
      • Exercise 9.4: Add fields to the index
      • Exercise 9.5: Extend the search with Facets
    • Unit Summary
  • UNIT 10: SITE PERFORMANCE
    • Overview
    • Planning for Peformance
    • Define Goals and Requirements
    • Review current issues and bottlenecks
    • Other performance considerations
    • Unit 10 Summary
    • Glossary of terms
    • Appendices
Powered by GitBook
On this page
  • Configure Facets
  • Add State/Territory facet
  • Place new Facet block in Content Top
  • Create facet for Agency field

Was this helpful?

Edit on GitHub
Export as PDF
  1. UNIT 9: SEARCH AND RELATED CONTENT
  2. Search and related content

Exercise 9.5: Extend the search with Facets

PreviousExercise 9.4: Add fields to the indexNextUnit Summary

Last updated 1 year ago

Was this helpful?

Facets is a great tool to improve search UI by adding filtering options that the end user can use to filter the search results by category, price, location or any other similar fields. A typical use of a Facet is to allow filtering the search results by a price range on a shopping cart website, or filtering jobs based on location.

Our Job posting content type provides fields such as Terms of employment, State/Territory and Agency. Let’s add them as facets and see if that improves our search.

Facets module is already enabled in your training environment.

Configure Facets

  1. Go to Administration → Configuration → Search and metadata → Facets. This page has a few facet sources available. These facets were created for you by the Facets module from each of the Views in your site. As you may expand your site with more Views that use a Search API index, they all become available here.

  2. Locate our Job search in the Facet source, and click configure:

  3. Enter a unique filter key. This key will be used in the query string to identify the facet source, which avoids errors when using multiple facets. We could leave this configuration empty; in which case the Facets will use an internally generated string.

Add State/Territory facet

  1. Click the Add facet button.

  2. Select View Jobs Search, display Page as the Facet Source.

  3. Select State (field_jobstate) as the Field.

  4. Enter State/Territory in the Name field. This will be used as the facet header.

  5. Save the configuration and configure the facet.

  6. Widget: List of checkboxes.

  7. Show the amount of results: selected.

  8. List item label: selected.

  9. Transform entity ID to label: selected.

  10. URL alias: state.

  11. Empty facet behaviour: Do not display facet.

  12. Operator: OR.

  13. Sort by active state: not selected.

  14. Sort by count: not selected.

  15. Sort by display value: selected.

  16. Sort order: Ascending

  17. The “Sort by display value: Ascending” will ensure the taxonomy terms for the State/Territory will be listed alphabetically.

    Alternatively, we may enable the weight-based ordering of the facet filters to replicate the term sorting in the taxonomy vocabulary. For this to work, you unselect the “Sort by display value” above and select the “Sort by taxonomy term weight” checkbox.

    For now, leave the “Sort by display value” selected.

  18. Save the configuration. This will create a block, which we have to place into the Content top region, so it appears to the end user.

Place new Facet block in Content Top

  1. Navigate to the Structure → Block Layout.

  2. Place the State/Territory block (category Facets) into the Content above region.

  3. Restrict the visibility of the block to the Jobs Search page (/jobs-search).

  4. Save blocks the block layout page.

  5. Test your facet by navigating to the Jobs Search page.

Create facet for Agency field

Use your experience from the previous step and create a facet for the Agency field. Place it as a block in the Content Top region.

Image of Jobs Search with facets
Image of Configure Jobs search facet
Image of Configure Jobs search facet
Image of Agency facet
Image of Configure Jobs search facet
Image of Configure Jobs search facet
Image of Configure Jobs search facet
Image of Configure Jobs search facet
Image of Configure Jobs search facet
Image of Configure Jobs search facet