Skip to content

ContentBundle/Teaser does not using locale when searching documents #3434

@ghost

Description

Q A
Bug? yes
New Feature? no
Sulu Version 1.5+, 1.6+
Browser Version -

Actual Behavior

Teaser block skip current chosen locale
ContentTeaserProvider - does not take into account locale when searching documents

Expected Behavior

Teaser block showing documents in current chosen locale
ContentTeaserProvider - take into account locale when searching documents (takes current locale)

Steps to Reproduce

  1. create document in several locales (example: EN & DE)
  2. create document with teaser block in several locales EN & DE
  3. choose created (on first step) document in teaser block

Current result:

  • teaser block shows document in one locale (for an example EN) for both documents (EN & DE) with teaser block

Shold be:

  • teaser block should contain document in same locale

Possible Solutions

Include locale when searching documents for teaser block

https://github.com/sulu/sulu/blob/1.5.4/src/Sulu/Bundle/ContentBundle/Teaser/ContentTeaserProvider.php#L60-L63

@@ -60,6 +60,7 @@
         $searchResult = $this->searchManager
             ->createSearch(implode(' OR ', $statements))
             ->indexes($this->getPageIndexes())
+            ->locale($locale)
             ->execute();
 
         /** @var QueryHit $item */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions