Skip to content

feat: Add IAccountScopedSearchProvider - #64491

Open
CarlSchwan wants to merge 5 commits into
masterfrom
carl/investigation-api
Open

CarlSchwan wants to merge 5 commits into
masterfrom
carl/investigation-api

Conversation

@CarlSchwan

@CarlSchwan CarlSchwan commented Sep 17, 2026

Copy link
Copy Markdown
Member

Summary

See occ search:providers and occ search:query for using this

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch 3 times, most recently from 789c118 to e9d774b Compare September 21, 2026 12:20
@CarlSchwan
CarlSchwan marked this pull request as ready for review September 21, 2026 12:22
@CarlSchwan
CarlSchwan requested review from Altahrim, icewind1991, leftybournes and salmart-dev and removed request for a team September 21, 2026 12:22
@CarlSchwan CarlSchwan added the 3. to review Waiting for reviews label Sep 21, 2026
@CarlSchwan CarlSchwan self-assigned this Sep 21, 2026
@CarlSchwan CarlSchwan added this to the Nextcloud 36 milestone Sep 21, 2026
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch from e9d774b to 313d1c7 Compare September 21, 2026 13:12
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch from 313d1c7 to 4c0220e Compare September 21, 2026 14:27
#[AsCommand(
name: 'search:providers',
description: 'List the registered account-scoped search providers and the fields each one can be searched on',
help: 'This command is experimental: it queries NCU\Search\IAccountScopedSearchProvider, which is itself experimental and may still change or be removed.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

having the technical gobbledygook in admin facing strings is not great.

/**
* @psalm-import-type DeclarativeSettingsFormField from \OCP\Settings\IDeclarativeSettingsForm
*/
class AccountScopedSearchProvider implements IAccountScopedSearchProvider {

@icewind1991 icewind1991 Sep 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use distinct class names so we don't end up with N different AccountScopedSearchProvider classes in different namespaces

Comment on lines +83 to +90
$fields = [
['id' => 'name', 'title' => $this->l10n->t('Name'), 'type' => 'text', 'default' => ''],
['id' => 'path', 'title' => $this->l10n->t('Path'), 'type' => 'text', 'default' => ''],
['id' => 'mimetype', 'title' => $this->l10n->t('File type'), 'type' => 'text', 'default' => ''],
['id' => 'size', 'title' => $this->l10n->t('Size'), 'type' => 'number', 'default' => 0],
['id' => 'modified', 'title' => $this->l10n->t('Modified'), 'type' => 'number', 'default' => 0],
['id' => 'created', 'title' => $this->l10n->t('Created'), 'type' => 'number', 'default' => 0],
];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we reuse the data from FileSearchBackend::getPropertyDefinitionsForScope here somehow? or create a shared source of truth somewhere else

Comment on lines +305 to +309
$chunks = array_map(
static fn (array $chunk): ISearchOperator
=> new SearchComparison(ISearchComparison::COMPARE_IN, 'fileid', array_values($chunk)),
array_chunk($ids, self::ID_CHUNK),
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there is no need to chunk here, the backend will take care of it


return [
'shared' => $entries !== [],
'externally' => array_filter($entries, static fn (array $e): bool => $e['external']) !== [],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

array_any or track a single boolean trough the above loops.

@icewind1991

Copy link
Copy Markdown
Member

(only looked at part of the code so far, non-existence of comments on code should not be takes as a non-existence of (possible) issues)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants