I have implemented Search API Autocomplete 7.x-1.0+8-dev and it is working well (after making tweaks to remove stemmed results). However, I need to include the Title field for one Content Type only in the returned suggestions. I have indexed the Title field and selected it in the settings to be included in the autocomplete results. However, this simply returns results for key terms that exists in the Title field for ALL content types.

I can't use the Bundle Filter data alteration when indexing to only index one content type because I need the Title field searchable for all of the other content types for other searches and page renderings. I also thought about creating an aggregated field, but there is no option to limit by content type.

Does anyone have any ideas how to address this either through configuration, or provide some general direction on how to make the necessary modification by perhaps adding another variable? My coding skills are light, so creatively addressing this is preferred.

Comments

drunken monkey’s picture

Does the view in question (I assume it's a view, otherwise please specify) show only results from that content type? In that case, it should already work, all filters on the view itself should be transferred as-is to the autocomplete search query. If it doesn't, then please provide detailed steps to reproduce (and make sure it can be reproduced in a clean module version and that your modifications didn't cause the problem).

Otherwise, I don't think this is possible without some custom code.

narkoff’s picture

Yes, this is a view that has several displays. Each display returns a different content type. I am trying to get autocomplete to only return results from one specific display that only has one content type. However, Autocomplete is returning results from other displays where there is a match.

In the Autocomplete settings, I have set the 'Views display' setting to the display that I want to limit my autocomplete results to, but it does not seem to have any effect. Shouldn't this setting limit my results to the one display?

drunken monkey’s picture

In the Autocomplete settings, I have set the 'Views display' setting to the display that I want to limit my autocomplete results to, but it does not seem to have any effect. Shouldn't this setting limit my results to the one display?

Yes, that's exactly what this setting is there for, and I cannot reproduce your problem. Did you clear the browser (and maybe Drupal) cache after making the change in the Autocomplete settings, and are you using the latest releases (or maybe even dev versions) of all associated modules (mostly this one)?

narkoff’s picture

I am using all Dev releases for Search API Solr, Search API, Search API Autocomplete. I cleared browser and Drupal cache, but still the same result - autocomplete suggestions from other displays is returned along with the selected display in Autocomplete settings.

I'll need to try this on a clean install, but don't have the time right now. Will update when I can. Thanks for your guidance.

narkoff’s picture

I've decided to go a different route and use the Search Autocomplete module instead. Interestingly, that module works with Search API. Not sure if you have had a chance to look at it or not, but there are some nice features that are not in Search API Autocomplete (and vis-versa). A collaborative module would be nice.

Either way, thanks for your time and your modules!

drunken monkey’s picture

Status: Active » Fixed

No, I didn't know of that module, but it really looks great!
I don't think a cooperation will be possible, though, since the two approaches seem to be quite different. But still, good to know about it and maybe tell people to try that one, too. Thanks!

Status: Fixed » Closed (fixed)

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