Unable to display search results for translated and default language content

Created on 6 September 2016, over 8 years ago
Updated 9 June 2023, over 1 year ago

I would like to create a view of a search index that displays translated content for the current selected language, but were content has not been translated it should display the content in the default site language.

This is possible in a normal content view by adding a 'Default translation' filter and then setting the rendering language to 'Interface text language selected for page'. When trying to do this with a Search API index view, I can index the 'Default translation' field, so I can use it as a views filter, but there are no language options in the view so I'm unable to set the rendering language. This results in the view showing results for the default site language whatever language has been selected. If I omit the 'Default translation' filter then the view displays a row for all each translation, showing the content in all the languages there is a translation for.

Am I missing something or is there is a different way to construct views like this when using the Search API?

I have been using the latest 8.x-1.x-dev version of the module with the database backend.

πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom stephen-cox

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡ͺSweden svena

    Hmm.. This is not work for me at all. Can't find any setting for language at all. Nothing for default language in the view and no language setting in the search api. My index result view shows the nodes and it's translated version.
    I have Search api 8.x-1.29 and Search api Autocomplete 8.x-1.7 No Solr module just internal Search Database.
    A solution is to have one view for each language, but that is a messy solution I think.

Production build 0.71.5 2024