From 4a822681d2ac3fa9f49b11d0a6aafc2fcaaba0fb Mon Sep 17 00:00:00 2001 From: Thomas Schedler Date: Wed, 23 Mar 2022 12:48:48 +0100 Subject: [PATCH] Fix data-source prefix query (#605) --- Content/PageTreeArticleDataProvider.php | 2 +- Tests/Functional/Content/PageTreeArticleDataProviderTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Content/PageTreeArticleDataProvider.php b/Content/PageTreeArticleDataProvider.php index 09ee53bd3..6f631b2db 100644 --- a/Content/PageTreeArticleDataProvider.php +++ b/Content/PageTreeArticleDataProvider.php @@ -64,7 +64,7 @@ protected function createSearch(Search $search, array $filters, string $locale): if ($document instanceof BasePageDocument && $document->getResourceSegment()) { // the selected data-source could be removed - $search->addQuery(new PrefixQuery('route_path.raw', $document->getResourceSegment())); + $search->addQuery(new PrefixQuery('route_path.raw', $document->getResourceSegment() . '/')); } return $search; diff --git a/Tests/Functional/Content/PageTreeArticleDataProviderTest.php b/Tests/Functional/Content/PageTreeArticleDataProviderTest.php index 523a8d116..8de168972 100644 --- a/Tests/Functional/Content/PageTreeArticleDataProviderTest.php +++ b/Tests/Functional/Content/PageTreeArticleDataProviderTest.php @@ -51,7 +51,9 @@ public function setUp(): void public function testFilterByDataSource() { $page1 = $this->createPage('Test Page', '/page-1'); - $page2 = $this->createPage('Test Page', '/page-2'); + + // Tests additionally that the trailing slash in the prefix query is there + $page2 = $this->createPage('Test Page', '/page-1-1'); $articles = [ $this->createArticle($page1, 'Test 1'),