Contentful logo

Contentful Community

Query to filter entries with locale being defined won't check fallback

I have a search field I’m returning auto suggestions for. In this case the input is being compared with the entry’s title field. It works fine, but I’m currently trying to implement localization for this specific query:

export const NEWS_AUTO_SUGGESTIONS = gql`
    query GetNewsAutoSuggestions($query: String!, $locale: String) {
        newsArticleCollection(limit: 15, locale: $locale, where: { title_contains: $query }) {
            items {
                sys {
                category {

Default and fallback locale is en-US
The issue I have is, that when f.e. the german locale de is set, only entries that have a german title are being queried, how can I also query the fallback entries though?

It is expected that the fallback does not apply. The reason is that the fallback mechanism is applied after doing the query, so a query with locale=de will search for matching entries using that locale but without taking into account any fallbacks.

As a workaround, you could use aliases to combine multiple queries of different locales and then on the front end, check if de is returned, and if not, use en-US

1 Like