Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
We're using
Search API Autocomplete https://drupal.org/project/issues/search_api_autocomplete
with Search API 7.x-1.9 https://drupal.org/project/search_api
on a site set up with Solr (Websolr) serving nodes in both English and German.
I'm looking to be able to filter the results by ss_search_api_language field which is presently not happening and as such i get autocomplete results for all both languages.
What would be the correct approach to deal with this?
Thanks
Comments
Comment #1
f0ns CreditAttribution: f0ns commentedAlso looking for a solution to make sure only suggestions of the current active language
global $language->language;
are shown.Comment #2
f0ns CreditAttribution: f0ns commentedFixed this issue, made a custom module with this hook:
Make sure the language of your nodes are in the index.
Comment #3
drunken monkeyGlad that you could solve this yourself, and thanks a lot for posting your solution!
However, the last three lines could actually be written as one:
Creating a new filter for a single condition (or, "AND" conditions in general) isn't necessary.
Comment #4
drunken monkeyOh, and the operator should be
=
, not==
! If the latter works it's only due to a glitch in whatever backend you are using and not something you should rely on.Comment #6
pinueve CreditAttribution: pinueve commentedHi drunken monkey
I need some help, I manage to setup in Acquia cloud a multilingual site (with lingotek D7 module) having Aquia search (solr), search api and search api autocomplete, I tried above code with no luck, site is English based and just (for start) I added spanish, autocomplete only works in English, viewing site in spanish, query runs in english object, could you please point me where I can alter query so search is done over translated text?