Active
Project:
Autocomplete Widgets for Text and Number Fields
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2012 at 19:07 UTC
Updated:
20 May 2014 at 18:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bleen commentedcan you export your content type and post the result. So far I am unable to reproduce
Comment #2
mrtoner commentedI'm not sure how to export a content type?
Comment #3
bleen commentedI have spent some time this morning on this with another developer at Drupalcon and we simply cannot reproduce. The only possible cause we came up with is that perhaps you chose "case-sensitive" when setting up the widget and the actual data you have is not the same case.
So, unless you can give me reproducible steps I'm going to close this issue.
Comment #4
mrtoner commentedI dug into this a bit tonight, figured out the query you're building and found that you can easily reproduce this:
1. Create a field with an autocomplete widget, using existing field values, and assign it to a content type.
2. Create 10 nodes of that content type. For each of the fields with the autocomplete widget, give it a value of "John Smith".
3. Create an 11th node, with a field value of "John Carter".
4. Create node #12 -- type "j" in the field. "John Carter" will not show as a possible option.
The problem is here:
$options = _autocomplete_widgets_get_options($field, $string, $match, NULL, 10);You're attempting to limit the number of options to 10, but what is actually happening is that you've limited the number of records returned by the query to 10 -- the first 10. Instead, you need to return all possible values from the db, reduce those to only unique values, and then reduce those to 10.
Comment #5
bleen commentedThat's a different scenario than the one in your original post ... I was only testing with 4 elements.
I'll take a closer look at this.
Comment #6
mrtoner commentedSorry, I wasn't clear (as I realized when I last posted): that was four unique values, with 200+ total entries.
Comment #7
bleen commentedI didnt have a ton of time to test this, but I think this should work.... can you please kick the tires
Comment #8
mrtoner commentedSeems to work fine, if
$selct->distinct();is
$select->distinct();Comment #9
bleen commentedok .. I committed this to dev (with "select" spelled correctly)
Wooot!
Comment #10
mrtoner commentedAny chance of getting the returned results sorted alphabetically?
Comment #11
bleen commentedmrtoner ... open a new issue (feature request)
Comment #13
mrogers commentedJust want to confirm that I experienced this issue today (both with stable and dev) and the patch in #7 fixed it.
Comment #14
bleen commentedI dont understand ... this was added to DEV here: http://drupalcode.org/project/autocomplete_widgets.git/commit/9664748. Did you have to re-patch?
Comment #15
mrogers commentedYep, had to repatch. It's not in the 7.x dev version linked on the project page, as far as I can tell.