I'm using the module to autocomplete from existing field data, using a 'contains' search. At the moment, I have four unique field entries:

Artist D 100% (ASCAP)
Artist D 50% (ASCAP)
Artist J 100% (ASCAP)
Artist J 50% (ASCAP)

If I type "5" I get both Artist D 50% (ASCAP) and Artist J 50% (ASCAP). However, "J" gives me Artist J 100% (ASCAP), "D" gives me Artist D 100% (ASCAP) -- neither one with the 50% option.

Files: 
CommentFileSizeAuthor
#7 1430418.patch454 bytesbleen18

Comments

can you export your content type and post the result. So far I am unable to reproduce

I'm not sure how to export a content type?

Status:Active» Closed (cannot reproduce)

I 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.

Status:Closed (cannot reproduce)» Active

I 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.

That'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.

Sorry, I wasn't clear (as I realized when I last posted): that was four unique values, with 200+ total entries.

Status:Active» Needs review
StatusFileSize
new454 bytes

I didnt have a ton of time to test this, but I think this should work.... can you please kick the tires

Status:Needs review» Reviewed & tested by the community

Seems to work fine, if

$selct->distinct();

is

$select->distinct();

Status:Reviewed & tested by the community» Fixed

ok .. I committed this to dev (with "select" spelled correctly)

Wooot!

Any chance of getting the returned results sorted alphabetically?

mrtoner ... open a new issue (feature request)

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.