Skip to content

Commit

Permalink
Fix data-source prefix query (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
chirimoya authored Mar 23, 2022
1 parent ede1c38 commit 4a82268
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Content/PageTreeArticleDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Tests/Functional/Content/PageTreeArticleDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 4a82268

Please sign in to comment.