- Issue created by @jonathan_hunt
- 🇩🇪Germany mkalkbrenner 🇩🇪
I think that this is the wrong way. I know so many multilingual sites that don't have any content available in any language. And none of them has to deal with custom code like that.
Drupal itself has a language fallback system, display the default translation if a required translation is not available.
And this path is followed by Search API and Search API Solr.Just add the general "Language (with fallback)" field to your index and filter the view using that field.
- 🇳🇿New Zealand jonathan_hunt
Thanks for the feedback. I added
Language (with fallback) (language_with_fallback)
to the index, and also the search results view is now filtered by, either
1. "Language (with fallback)" filtered by Site's default language:
1.1 returns 0 results for a keyword that exists only in non-default translation
1.2 returns 1 result for keyword present in 2 translations
2. "Language (with fallback)" filtered by each of the available languages:
2.1 returns 1 match for keyword present in non-default translation
2.2 returns 2 results for keyword present in 2 translationsHowever, the desired result is that users get:
a. 1 result for a keyword that exists only in non-default translation
b. 1 result for keyword present in 2 translations (since once they visit the node they will see what non-default language field values exist).
At this stage the{!collapse field=ss_nid_string}
avoids the 2 results for same node issue.This site may differ from others in that we don't offer a user language switcher since 99% of site is in english, with sparse translations available.