Problem/Motivation

Currently, there is only a search field and the options displayed - there is no label indicating what we are actually filtering by, like in the examples below:
https://www.algolia.com/doc/guides/building-search-ui/widgets/showcase/js/
https://ecommerce-store.typesense.org/
https://linux-commits-search.typesense.org/

Proposed resolution

When the Facet option is enabled for a field, there should be an additional input for specifying the Label, which should also be translatable for multilingual support.
After that, similar to the TypesenseClient::getFields() function, we could read the labels from the schema (e.g., getFieldLabels) and pass them to the JS.

In a similar way, many other settings related to the fields could be added to the schema, so that JS can handle them dynamically during rendering - just like in the Facets module.
This way, all configurations would be managed within the site build.

Examples of such settings include:
- Show search box
- Show the amount of results
- Limits (soft, hard) - Limit the number of displayed facets (+ Show more label, Show less label, Show reset link)
- Hide facet with 1 result - When the facet has only one result, it will be hidden
- Range slider - Add range results for all the steps between min and max range
- URL alias - The alias appears in the URL to identify this facet (for routing)
- etc.

Comments

norbert-goco created an issue. See original summary.

lussoluca’s picture

robertoperuzzo’s picture

StatusFileSize
new557.88 KB

Hi norbert-goco,

I made some improvements on this MR, so if you have time to test this patch, it will be great!

Regarding the UI, you may find a custom Search Block that you can place wherever you want using the Block Layout, and I add some labels to improve the search interface.
search interface

robertoperuzzo’s picture

Status: Active » Needs review
robertoperuzzo’s picture

I mark it as Fixed because the related issue #3532607: Add a custom block to render the search UI has been merged.

@norbert-goco, if you have any feedback to share, please feel free to leave a comment here or open a new issue. Thank you for your valuable support!

robertoperuzzo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.