Full user input is not searched when it contains a comma ","

Created on 12 August 2025, 4 days ago

Problem/Motivation

I am currently investigating using this module and have found an issue with how core's autocomplete handles "," which results in unexpected results using this plugin.

In my context I am searching for an address - so a common user input might be "123 Foobar street, Fooville"

Viewing the network tab I can see that only the user input after the comma is sent to the backend (e.g "Fooville") which results in a sudden change in the returned results.

This behaviour appears related to how the core autocomplete java script handles inputs.

When the user inputs a value then autocomplete.searchHandler inside autocomplete.js is called.

This then is calling autocomplete.extractLastTerm which returns only the content after the last occurrence of ,

This is what is then passed to the callback / Autocomplete controller.

Proposed resolution

Inside search_api_autocomplete.js it looks like we could override the searchHandler option with a custom function that ensure the user input is passed to the backend as entered rather than split.

🐛 Bug report
Status

Active

Version

1.0

Component

General code

Created by

🇳🇿New Zealand ericgsmith

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

Comments & Activities

Production build 0.71.5 2024