String "0" not printed as suggestion suffix

Created on 11 December 2024, about 1 month ago

Problem/Motivation

If the suggestion suffix in search-api-autocomplete-suggestion.html.twig is a string with value "0", the suggestion suffix is not printed.

Steps to reproduce

Example:

  • Autocomplete suggestions for a SKU field activated.
  • We have following SKUs: SKU1, SKU10, SKU11, SKU12
  • Now if we type SKU1, four suggestions are given, but there is two times "SKU1", but "SKU10" is missing.
  • If we instead type only SKU: "SKU1" and "SKU10" are shown.

Proposed resolution

This is because of checking for empty variable in TWIG with {% if suggestion_suffix %}. This gives false if suggestion_suffix string is "0". To avoid this, one should better check like this:{% if suggestion_suffix is not empty %}.

It seems that at least for suggestion_prefix this should be changed too. For results_count probably not, for others I am unsure.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

General code

Created by

πŸ‡©πŸ‡ͺGermany stefan.korn Jossgrund

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024