If I enter any numeric value into the search field, the autocomplete list correctly returns a list of suggestions beginning with the numbers I entered. If I then select a number from the list, it always returns a single digit value between 0 and 3. For example, if I select "4313" from the list, "0" is filled in instead of "4313." If I type in "4313" and ignore the autocomplete list, the search results are correct. I tested with both the custom and Drupal widgets and got the same results.
Our current project - when we roll out this next month - will encourage users to search by zip code. Has anyone else experienced this issue or is it just my setup/configuration? Thanks for your help.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | apachesolr_autocomplete-999772-d7.patch | 1.85 KB | janusman |
| #5 | apachesolr_autocomplete-999772-d6.patch | 1.68 KB | janusman |
Comments
Comment #1
vanillawater commentedSame here.
It returns the array key instead of the selected numeric value.
Thanks
Comment #2
com_net commented+1 subscribe
Comment #3
butler commentedSame here subscribe
Comment #4
marcoka commentedsame here, too
Comment #5
janusman commentedThis problem is PHP related: the suggestions array built inside the suggesting functions could look, say, like this:
but when that array is returned, PHP insists the FIRST key is not the string "14", but an integer... and thus replaces the key 14 with a 0, so it looks like this when you var_export() it:
So this is a patch that forces all indexes to be a string by prepending a "*" to all keys on the array, which is then removed before being shipped back to the browser.
Please review!
Note: Patches for both D6 and D7.
Comment #6
janusman commentedCommitted to 6.x and 7.x (HEAD) branches.
Comment #8
rhymeswithcamera commentedThanks for fixing this! Works beautifully now.