Skip to content

IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause#107

Merged
ViniTou merged 3 commits into4.6from
ibx-11146-use-terms-4.6
Feb 12, 2026
Merged

IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause#107
ViniTou merged 3 commits into4.6from
ibx-11146-use-terms-4.6

Conversation

@ViniTou
Copy link
Contributor

@ViniTou ViniTou commented Jan 20, 2026

🎫 Issue IBX-11146

Related PRs:

Description:

Problem

When many languages are configured in Ibexa (e.g., >20-30), the language fallback logic in NativeCoreFilter generates an exponentially growing number of boolean clauses. This causes Solr queries to fail with a maxBooleanClauses error (default limit is 1024).
The problematic query structure for exclusion was:
NOT (content_language_codes_ms:"lang1" OR content_language_codes_ms:"lang2" ...)
For a fallback chain, this exclusion is repeated for every priority level, leading to O(N^2) complexity in clause count.

Solution

Optimized the query generation to use Solr's Terms Query Parser ({!terms}) for language exclusions. This parser treats a list of values as a single query clause, regardless of the number of elements.
The new query structure is:
_query_:"{!terms f=content_language_codes_ms}lang1,lang2..."
This reduces the complexity from O(N^2) boolean clauses to O(N) single clauses, effectively bypassing the maxBooleanClauses limit for this use case.

Applies strtolower() to values because the Terms parser bypasses analysis, but the underlying field (content_language_codes_ms) is lowercased in the schema.

For QA:

Dont focus at the 50 languages thing - check if site access combinations languages work properly, take alwaysAvailable flag into consideration, fallback, default languages and so on.

Documentation:

@ViniTou ViniTou force-pushed the ibx-11146-use-terms-4.6 branch from ccf7642 to b96aee5 Compare January 20, 2026 13:28
@ViniTou ViniTou changed the title IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause [TMP] IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause Jan 20, 2026
@ViniTou ViniTou requested a review from a team January 20, 2026 15:06
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 bot requested review from Steveb-p, alongosz, barw4, ciastektk, konradoboza, mikadamczyk, tbialcz and wiewiurdp and removed request for a team January 20, 2026 15:06
composer.json Outdated
"ext-json": "*",
"ext-xmlwriter": "*",
"ibexa/core": "~4.6.0@dev",
"ibexa/core": "dev-ibx-11146-integration-test-for-solr-languages as 4.6.0@dev",
Copy link
Contributor

Choose a reason for hiding this comment

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

Friendly reminder before merge

Copy link
Member

Choose a reason for hiding this comment

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

We need to switch to our composer-install action and use dependencies.json instead.
At this point I think this is more of a note to myself :D

Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

Nice one 💪 I was aware of these long queries for quite some time, but never came up with a proper solution 😅

composer.json Outdated
"ext-json": "*",
"ext-xmlwriter": "*",
"ibexa/core": "~4.6.0@dev",
"ibexa/core": "dev-ibx-11146-integration-test-for-solr-languages as 4.6.0@dev",
Copy link
Member

Choose a reason for hiding this comment

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

We need to switch to our composer-install action and use dependencies.json instead.
At this point I think this is more of a note to myself :D

@ViniTou ViniTou force-pushed the ibx-11146-use-terms-4.6 branch from 718cd09 to 452418e Compare January 30, 2026 11:22
@sonarqubecloud
Copy link

@ViniTou ViniTou changed the title [TMP] IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause IBX-11146: Updated filtering logic to use LanguageCode criterion with {terms} clause Jan 30, 2026
@tomaszszopinski tomaszszopinski self-assigned this Feb 11, 2026
@tomaszszopinski
Copy link

🟢 ibexa/experience#575

Copy link

@tomaszszopinski tomaszszopinski left a comment

Choose a reason for hiding this comment

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

QA approved on Ibexa DXP 4.6 ddev/solr9

@ViniTou ViniTou merged commit 51061fc into 4.6 Feb 12, 2026
23 checks passed
@ViniTou ViniTou deleted the ibx-11146-use-terms-4.6 branch February 12, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants