Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Tests\Integration\Core\Repository;

use Exception;
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;

/**
* @group integration
* @group search
*/
final class SearchServiceManyLanguagesTest extends BaseTest
{
public function testFindContentWithManyLanguages(): void
{
$repository = $this->getRepository();
$languageService = $repository->getContentLanguageService();
$searchService = $repository->getSearchService();

// Create 50 languages to trigger maxBooleanClauses (usually 1024)
$languages = ['eng-GB'];
for ($i = 0; $i < 50; ++$i) {
$code = sprintf('tst-%02d', $i);
$langCreateStruct = $languageService->newLanguageCreateStruct();
$langCreateStruct->languageCode = $code;
$langCreateStruct->name = "Test Language $i";
$langCreateStruct->enabled = true;

try {
$languageService->createLanguage($langCreateStruct);
} catch (Exception $e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could narrow it down to \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException

// Ignore if already exists
}
$languages[] = $code;
}

$query = new Query();
$query->filter = new Criterion\MatchAll();
$query->limit = 1;

$languageSettings = [
'languages' => $languages,
'useAlwaysAvailable' => true,
];

// This should not throw maxBooleanClauses exception
try {
$result = $searchService->findContent($query, $languageSettings);
} catch (Exception $e) {
$this->fail('Search failed with many languages: ' . $e->getMessage());
}
$this->assertGreaterThan(0, $result->totalCount);
}
}
Loading