Skip to content

feat(search): scope searches to a drive via the driveId field - #3299

Draft
dschmidt wants to merge 2 commits into
opencloud-eu:tmp/refactor-search-mappingfrom
dschmidt:feat/search-scope
Draft

feat(search): scope searches to a drive via the driveId field#3299
dschmidt wants to merge 2 commits into
opencloud-eu:tmp/refactor-search-mappingfrom
dschmidt:feat/search-scope

Conversation

@dschmidt

@dschmidt dschmidt commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

scope: takes an opaque resource id, which is hostile to hand-written queries. Accept driveId:"<storage$space>" as a regular KQL field instead: it resolves to the indexed RootID and a bare drive id is completed to the root resource id. Combined with path: this gives a readable location scope with no token stripping, both compose with groups, OR and NOT like any other field.

Second commit prunes the space fan-out when top-level AND conjuncts pin the query to a single root; conservative rules, the restriction stays in the query, mountpoints are kept for path mapping.

Follow-up (deliberately not here): parse the query once in the service and hand the AST to the engines, which currently re-parse per space; that changes the engine interface.

Stacked on #2659.

@dschmidt
dschmidt changed the base branch from main to tmp/refactor-search-mapping August 12, 2026 23:53
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@dschmidt
dschmidt changed the base branch from tmp/refactor-search-mapping to main August 12, 2026 23:57
@dschmidt
dschmidt changed the base branch from main to tmp/refactor-search-mapping August 12, 2026 23:57
@dschmidt dschmidt changed the title feat(search): readable search scope via driveId and path query tokens feat(search): scope searches to a drive via the driveId field Aug 13, 2026
scope: takes an opaque resource id, which is hostile to hand-written
queries. Accept driveId:"<storage$space>" as a regular KQL field
instead: it resolves to the indexed RootID, and a bare drive id is
completed to the root resource id (a space root's opaque id is its
space id). Full root ids pass through untouched.

Combined with path: this gives a readable location scope without any
token stripping: both are plain fields, so they compose with groups,
OR and NOT like everything else.
When top-level AND conjuncts pin the query to a single root
(driveId/RootID restrictions), only that space's index is asked; the
restriction itself stays in the query, so this is purely an
optimization. Conservative by design: any top-level OR, negated or
group-nested restriction leaves the fan-out untouched, searching a
space too many is wasted work while skipping one would be wrong.
Mountpoints are kept for result path mapping.

Costs one extra parse of the query in the service; parsing once and
handing the AST to the engines (which currently re-parse per space) is
a follow-up that changes the engine interface.
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.

1 participant