Results missing when using a formatted field for results and searching with special characters

Created on 11 December 2013, over 11 years ago
Updated 23 April 2025, 9 days ago

We have a view set up with a separate field that displays the autocomplete data in a certain format. But we found that if you search with special characters such as apostrophes, the autocomplete seems to return no results.

I tracked it down to Line 132 of views_autocomplete_filters.inc. That line is as follows:

if (isset($item['value']) && strstr(drupal_strtolower($item['value']), drupal_strtolower($string))) {

First, I'm not sure why this line is here. I mean, if you search a view for $string, it should only return results with $string's value, right? But this line seems to just verify that the items actually do have this text in the value.

In my case, $item['value'] contains the HTML encoded version of $string, so they didn't match. Therefore, I modified it to this and it now works:

if (isset($item['value']) && strstr(decode_entities(drupal_strtolower($item['value'])), drupal_strtolower($string))) {

If it even makes sense to have this check for some reason I don't see, it seems helpful to add decode_entities() to make sure these things can match.

Thanks!

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dandaman

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.

  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    As Drupal 7.x and also modules 7.x versions "ended their lives", closing the 7.x issues.

    And thanks for participating and using the module.

    p.s. if this still an issue on the latest 2.x version, please feel free to re-open and update the version accordingly.

Production build 0.71.5 2024