Page MenuHomePhabricator

[SPIKE] Dynamically register scopes based on available extensions
Closed, ResolvedPublic

Description

Scoped Typeahead Search should only support searching the Lexeme namespace if the WikibaseLexeme is loaded. Likewise, the namespace IDs for all scopes should be injected from Mediawiki and not hard-coded.

Since investigation is needed here, making this a spike and giving it a timebox of 1 day.

Suggested Approach
Crosscheck the content namespaces from Mediawiki (wgContentNamespaces) with the namespaces we're looking for and decide on that basis whether the scopes should appear in the search.

Open Questions

  • How to handle EntitySchema since it's not included in the Wikibase Entity Sources
  • Whether the search scopes should include only Content Namespaces or whether the scopes should show up whenever the extensions are installed regardless of whether Lexeme / EntitySchema are registered as Content Namespaces.

Acceptance Criteria

  • Namespace IDs are not hard-coded in the Scoped Typeahead Search component implementation
  • Option for Lexeme namespace is only available when WikibaseLexeme is loaded on the target Mediawiki

Event Timeline

ArthurTaylor renamed this task from Dynamically register scopes based on available extensions to [SW] Dynamically register scopes based on available extensions.Feb 6 2025, 11:54 AM
ArthurTaylor created this task.
ArthurTaylor updated the task description. (Show Details)
ArthurTaylor renamed this task from [SW] Dynamically register scopes based on available extensions to [SPIKE] Dynamically register scopes based on available extensions.Feb 12 2025, 1:44 PM
ArthurTaylor updated the task description. (Show Details)

Change #1120184 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Show scopes in the scope dropdown based on datatype registration

https://gerrit.wikimedia.org/r/1120184

Sending this for review, since the spike is over. Filed T387986 as a follow-up to add EntitySchema support to the dropdown.

Change #1126948 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/WikibaseLexeme@master] Add handler for `WikibaseSearchableEntityScopesMessagesHook`

https://gerrit.wikimedia.org/r/1126948

Change #1120184 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Show scopes in the scope dropdown based on entity search registration

https://gerrit.wikimedia.org/r/1120184

Change #1126948 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Add handler for `WikibaseSearchableEntityScopesMessagesHook`

https://gerrit.wikimedia.org/r/1126948

(Not totally sure if this one goes into tech verification or if we only verify the parent task once that’s done.)