Hard limit selection on facets exposed filters

Created on 5 December 2024, 4 months ago

Problem/Motivation

As a developer I would like to see the "Hard limit" setting for facets ported over to the facets exposed filters.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States scott_earnest

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

Merge Requests

Comments & Activities

  • Issue created by @scott_earnest
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Something to note - in our case we are using search_api_opensearch - which will not set the limit (size) parameter if it is "0". We were seeing the default value for this api which was 10 records. Perhaps using other search api's "0" means "unlimited"?

  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Testing Instructions
    Create a Search API Index based view
    Create a facet exposed filter
    Find the new (old) field for "Hard limit"
    Verify this will affect the total number of options in the facet dropdown (you should be able to see this in the preview)

  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest
  • Pipeline finished with Success
    4 months ago
    Total: 804s
    #360654
  • πŸ‡¬πŸ‡§United Kingdom griz

    I'm also using OpenSearch and have experienced the same behaviour. This patch works for me.

  • πŸ‡¨πŸ‡¦Canada sagesolutions

    I'm using OpenSearch as the indexing backend, on Drupal 10 and Facets 3.0.0. The default is 10 items when no limit is set. Adding this patch allowed me to set the limit so I could show more.

    Marking as RTBC

  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest
  • πŸ‡ΊπŸ‡ΈUnited States johnny5th

    Patch works for me

  • πŸ‡§πŸ‡ͺBelgium StryKaizer Belgium

    Thanks,
    I do wonder, why hardcode the options? Wouldnt it make more sense to just use a numberfield, which allows the user to pick whatever they prefer?

  • Issue was unassigned.
  • Status changed to Needs work 28 days ago
  • πŸ‡ΊπŸ‡ΈUnited States chrisolof

    Confirming MR 262 is working great in my tests.

    +1 on the number field idea. It appears these hard-coded options are just carried over from the 2.x config form. Probably it makes for a nice clear "No limit" option chosen by default instead of an empty box. Maybe we'd need to modify this text:

    *NOTE: setting to "No limit" sets the hard_limit value to "0", which depending on the search backend could lead to limited results. Try setting to the maximum value if you are experiencing this issue

    To something like:

    Leave empty for no limit.
    Note: Some search backends will still apply a default limit when no hard limit is set. If this affects you, set this to an appropriately-high value or a value that indicates "no-limit" to your search backend.

    It appears this new setting still needs to be added into the module's config schema (config/schema/facets.views.schema.yml).

    Does this need test coverage?

Production build 0.71.5 2024