fix(search): resolve every schema's real register in cross-schema unified search#2019
Open
MWest2020 wants to merge 2 commits into
Open
Conversation
…fied search Completes the unified-search fix begun in #233. Even with the column/IN-limit crashes gone, OpenRegister objects still never appeared in Nextcloud's top-bar search. Two stacked causes: 1. ROOT CAUSE — ObjectService::searchObjectsPaginated auto-injected `_register = currentRegister` into every query. For a cross-schema search (the unified-search provider passes a `@self.schema` array and no register) this scoped the WHOLE search to one ambient register, so objects in every other register were invisible. Now the auto-inject is skipped whenever the query is multi-schema (`@self.schema` array / `_schemas` / `@self.schemas`). 2. MagicMapper::searchObjectsPaginatedMultiSchema built its schema->register map via registerMapper::findAll, which applies an organisation filter that collapsed the candidate set to a single register. It now builds the map from a DIRECT query over all registers and loads matched register entities lazily via find(_multitenancy:false, _rbac:false), so each searched schema is paired with its REAL owning register (correct magic table). Schema-membership parsing is extracted to extractSchemaIds() with list-vs-id-keyed-map handling. Verified live: searching "Rex" now returns the pet OBJECT (register 2411 / schema 4309) alongside its file and calendar event, over ~1000 searchable schemas, with no 54011 / 1000-IN errors. Magic tables only — no secondary index; Solr/Elasticsearch stay deprecated for unified search (docs/features/search-and-faceting.md updated). Quality: phpcs/phpstan/psalm clean on changed files (baseline counts adjusted for the env-independent find() named-arg pattern); unit tests for extractSchemaIds. Batching (opsx §2) deferred as hardening — the single union now works at scale.
OpenRegister object results in Nextcloud's top-bar search showed no icon
(the deep-link fallback `icon-openregister` is a CSS class the search
dropdown does not render). Schemas already carry an `icon` field (an MDI
name); this surfaces it.
- MdiIconRenderer: renders a curated set of @mdi/js glyphs (the pet-store
sample icons + common entity icons) to a standalone SVG / data URI.
- IconController + route GET /api/icon/mdi/{name}: serves the glyph as a
same-origin SVG image (public, cacheable). Nextcloud search only paints a
thumbnail from a real URL, so the icon is passed as the entry thumbnail.
- ObjectsProvider: when a schema has an icon, use it (square glyph) ahead of
the generic app icon; resolve schema/register display metadata with
_multitenancy/_rbac bypassed so a result whose schema lives in another
organisation still resolves its real name + icon instead of falling back
to the bare numeric id.
Verified live: searching "Rex" returns the pet with its Dog glyph and the
"· Pet" schema label. phpcs/phpstan/psalm clean on changed files; unit test
for MdiIconRenderer (normalisation, svg/dataUri, unknown→null).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Heropend na de migratie van Codeberg naar GitHub (2026-07-14).
Origineel, met review-historie: https://codeberg.org/Conduction/openregister/pulls/234