Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Search API Autocomplete does not find CEP (zipcode in Brazil) or number that starts with 0 (zero). Eg: When I type: 08090, no suggestion appears. If I digital 8090, it suggested 8090710 in the autocomplete field. But the number registered on the node is 08090710.
I need it to locate with 0 (zero) at the beginning.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2879881-3--preprocess_autocomplete_incomplete_keys.patch | 1.17 KB | drunken monkey |
| |||
#3 | 2879881-3--preprocess_autocomplete_incomplete_keys.patch | 1.17 KB | drunken monkey |
Comments
Comment #2
wesleybpereira CreditAttribution: wesleybpereira commentedComment #3
drunken monkeyApparently you're using the Database backend for your search server?
In that case, this is a known problem: to facilitate reliable searches for numbers, we index them in a canonical form, without sign or leading zeroes. Since autocomplete can only use the data in the index to create its suggestions, it can't know that that number originally had a leading zero, and creates the suggestion just for the bare number.
However, if we have hard-coded token preprocessing at indexing (and search) time, we should also do the same when creating autocomplete suggestions. The attached patch should at least alleviate the problem – please try it out!
Comment #4
drunken monkeyRe-attaching to trigger test bot.
Comment #5
wesleybpereira CreditAttribution: wesleybpereira commentedIt worked! Thank you so much.
Comment #7
drunken monkeyGood to hear, thanks for testing and reporting back!
Committed.