Skip to content

IBX-13142: Moved the legacy search engine off the language bitmask - #942

Open
Steveb-p wants to merge 13 commits into
feature/language-bitmask-1-content-6.0from
feature/language-bitmask-2-legacy-search-6.0
Open

Steveb-p wants to merge 13 commits into
feature/language-bitmask-1-content-6.0from
feature/language-bitmask-2-legacy-search-6.0

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-13142

Note

Part 2 of 6 of the language bitmask removal. Each part is green on its own; the bitmask keeps being written until #946 removes it.

Related PRs:

The stack that replaces the language bitmask, bottom to top. Each part is green and can be merged on its own, in this order:

  1. IBX-13142: Moved content and version languages from the bitmask to join tables #941: content and version languages in join tables
  2. this PR: legacy search engine off the bitmask
  3. IBX-13142: Moved URL aliases off the language bitmask #943: URL aliases off the bitmask
  4. IBX-13142: Moved content types off the language bitmask #944: content types off the bitmask
  5. IBX-13142: Moved object states off MaskGenerator #945: object states off MaskGenerator
  6. IBX-13142: Removed the language bitmask #946: removed the bitmask

ibexa/installer#246 goes first, as the Experience content it provisions has to match each step, and ibexa/installer#250 drops its schema checks after #946. ibexa/data-intelligence-layer#63 goes with #946.

Description:

The legacy search engine stops doing arithmetic on language ids. FieldBase and the field sort clause resolved the prioritized-language fallback with bit shifts, which only worked because ids were powers of two; LanguagePriorityConditionBuilder does it with correlated subqueries on the join tables instead. The language code and full-text criteria and the language filter of content and location search use the join tables too. Field language ids still carry the always-available bit until #946 strips it, so the builder compares them without it for now.

ibexa_search_object_word_link gets language_id and is_main_and_always_available columns, which AddSearchObjectWordLinkLanguageIdColumnsMigration fills from its mask. language_id is BIGINT, like the field and name language ids, since ids from the bitmask go up to 2^62. The indexer keeps writing the mask until #946. The index format changes with it, so the legacy search index needs a full reindex after upgrading.

Search\Legacy\Content\Handler::extractMatchedLanguage() takes the language ids and the main language id instead of a mask.

@Steveb-p Steveb-p changed the title IBX-11939: Moved the legacy search engine off the language bitmask IBX-13142: Moved the legacy search engine off the language bitmask Nov 13, 2026
@Steveb-p
Steveb-p force-pushed the feature/language-bitmask-2-legacy-search-6.0 branch 2 times, most recently from b3922d8 to 7a01108 Compare November 15, 2026 18:49
@Steveb-p
Steveb-p force-pushed the feature/language-bitmask-2-legacy-search-6.0 branch from 7a01108 to eabc420 Compare November 17, 2026 11:19
@Steveb-p
Steveb-p requested review from a team and alongosz November 17, 2026 11:53
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from barw4, bnowak, ciastektk and mikadamczyk and removed request for a team November 17, 2026 12:04
@Steveb-p
Steveb-p force-pushed the feature/language-bitmask-2-legacy-search-6.0 branch from eabc420 to d13be08 Compare November 18, 2026 11:49
@Steveb-p
Steveb-p requested a review from alongosz November 18, 2026 11:57
LanguageHandler $languageHandler,
JoinedTablesTracker $joinedTablesTracker
protected ContentTypeHandler $contentTypeHandler,
protected LanguageHandler $languageHandler,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is $languageHandler still needed? Since the switch to LanguagePriorityConditionBuilder nothing in FieldBase or its subclasses reads it, same for SortClauseHandler\Field::$languageHandler. The constructors break anyway, so it could go together with the $languageHandler: args in criterion_handlers_common.yml and sort_clause_handlers_common.yml

if (!isset($locations[$locationId])) {
$locations[$locationId] = new SPILocation();
$locations[$locationId]->id = $locationId;
$locations[$locationId]->contentId = (int)$row['contentobject_id'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Leftover from the version where the handler grouped translations by $location->contentId? Nothing reads it now, same line in HandlerLocationSortTest

Suggested change
$locations[$locationId]->contentId = (int)$row['contentobject_id'];

use RuntimeException;

/**
* Adds "language_id" and "is_main_and_always_available" to "ibexa_search_object_word_link", backfilled from "language_mask".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The description still says the legacy search index needs a full reindex after upgrading, but per #942 (comment) the backfill is exact and no reindex is needed. Can you update it so nobody runs a full reindex for nothing?

Comment on lines +110 to +113
/**
* @param int|string|null $languageId
*/
protected function extractMatchedLanguage($languageId): ?string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this get a native type? The signature changes anyway. Also afaict matched_language_id can't be null anymore - both gateways fall back to c.initial_language_id, which is NOT NULL - so the null branch looks dead

ibexa_search_object_word_link gets language_id and
is_main_and_always_available columns, filled from its mask. The field
criteria and sort clause, the full-text and language code criteria and
the language filter of content and location search use the join tables
and those columns instead of arithmetic on the masks. The indexer keeps
writing the word link mask until the bitmask is removed, and field
language ids are compared without their always-available bit until it is
stripped.
ReindexCommand passes the --content-ids values as strings, and the
untyped remove() hands them on to SearchIndex's int parameters, which
strict types turned into a TypeError for deleted or unpublished content.
@Steveb-p
Steveb-p force-pushed the feature/language-bitmask-2-legacy-search-6.0 branch from e0a74e7 to f837065 Compare November 21, 2026 16:16
@sonarqubecloud

Copy link
Copy Markdown

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.

4 participants