Allow option for quant search facets to be alphabetical

Created on 10 September 2022, about 2 years ago
Updated 5 March 2024, 9 months ago

Problem/Motivation

Right now the search facets show up based on how many "hits" are per value. It would be nice if this could be alphabetical.

Steps to reproduce

  1. For a quant project that has search enabled
  2. Enable quant_search module
  3. Go to API tab and configure
  4. Go to Search tab
  5. Go to Pages sub-tab
  6. Click Add Quant search page button
  7. Fill in Label, Title and Route, and check inEnabled
  8. Add a facet for a vocabulary that has content associated with different terms
  9. Go to the search page route
  10. Results: The facet values are ordered based on number of hits/results per term
  11. Expected Results: Facet values are alphabetical

Proposed resolution

Algolia supports this so we'd have to either do this by default or make this configurable. Example:

https://stackoverflow.com/questions/52209832/algolia-instantsearch-custo...

So, js/quant-search.js could be updated like:

  instantsearch.widgets.refinementList({
    container: '#facet_' + facet.facet_container,
    attribute: facet.facet_key,
    sortBy: ["name:asc"],
   }),

When adding this, we may also want to:

  1. Work on this issue the same time as ✨ Quant search facet areas can be completely empty which isn't great UX Active
  2. Refactor the code so the identical config used for checkbox, menu, and select is passed in into the different functions
  3. Make the alphabetical option configurable
  4. If configurable, allow different support options (and possibly allow ordering): sortBy: ['isRefined', 'count:desc', 'name:asc']
  5. Consider some of the other simple Algolia options like operator: 'or' and limit: 5 / showMore: true

Remaining tasks

  1. Decide on approach
  2. Update code
  3. Code review + testing
  4. Commit :)

User interface changes

The user will see alphabetical facet values. TBD if they see a configuration option for this.

API changes

Data model changes

If configurable, we need to save the option.

✨ Feature request
Status

Postponed

Version

1.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024