#1422638: Only use relevant fields for autocomplete query could be expanded to allow the user to freely choose the fields that should be used for the autocomplete query. This could be useful in some advanced setups. Per default, the current detection technique would be employed.

Comments

mh86’s picture

An UI for this sounds like a nice idea. Where would you place such an option?

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new3.67 KB

Please see and test the attached patch!

mh86’s picture

Status: Needs review » Needs work
StatusFileSize
new12.53 KB

Setting the fulltext field works fine, but the admin form is broken in certain cases.
I've activated the "Complete entity view" fulltext field, and disabled it afterwards. When viewing the autocomplete setting form, 2 checkboxes are listed, but the one for the disabled entity view fulltext field has no label (see screenshot)

drunken monkey’s picture

Once again, I cannot reproduce your problem. It's also not apparent in the code how this could happen. I just use $index->getFulltextFields() to retrieve the available options.
Of course, that method has an internal static cache, but this should only affect the outcome if you'd disable the field in the same page request as showing the form, or when you have some improper entity caching in place. And even these problems should be fixed with #1414138-20: Notice: Undefined index: search_api_access_node.
So, I really have no idea what goes wrong there for you. Does clearing cache help? Do you have some entity caching in place?
Otherwise, please debug $index->getFulltextFields() to see why it returns an unindexed field, and/or check if the stored index object is correct ($index->options['fields'] doesn't contain search_api_viewed).

mh86’s picture

Status: Needs work » Reviewed & tested by the community

Now I can't reproduce it either, so marking it as RTBC. If I see this problem again, and have more information, I'll open a separate issue.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

OK, committed.

Status: Fixed » Closed (fixed)

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