Skip to content

feat: Add IAccountScopedSearchProvider - #64491

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

CarlSchwan wants to merge 6 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
@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch 2 times, most recently from 313d1c7 to 4c0220e Compare September 21, 2026 14:27
Comment thread core/Command/Search/ProvidersCommand.php Outdated
Comment thread apps/dav/lib/CardDAV/Search/AccountScopedSearchProvider.php Outdated
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 thread apps/files/lib/Search/AccountScopedSearchProvider.php Outdated
Comment thread apps/files/lib/Search/AccountScopedSearchProvider.php Outdated
@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)

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch from bfccfe0 to c9a7b00 Compare September 23, 2026 15:02
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the carl/investigation-api branch from c9a7b00 to aa5f9aa Compare September 23, 2026 15:46
Comment on lines +54 to +58
default => array_reduce(
$operator->getArguments(),
static fn (bool $carry, ISearchOperator $child): bool => $carry && self::node($child, $values),
true,
),

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_all

Comment on lines +48 to +52
ISearchBinaryOperator::OPERATOR_OR => array_reduce(
$operator->getArguments(),
static fn (bool $carry, ISearchOperator $child): bool => $carry || self::node($child, $values),
false,
),

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

'path',
is_array($value)
? array_map(static fn (mixed $path): string => 'files/' . ltrim((string)$path, '/'), $value)
: 'files/' . ltrim((string)$value, '/'),

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.

this will break for groupfolders/external storages

return $value;
}

$term = preg_replace('/(?<!\\\\)[%_]/', ' ', $value) ?? $value;

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.

what is this doing?

*/
private function fileIdsToComparison(array $ids): ISearchOperator {
if ($ids === []) {
return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'fileid', -1);

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.

I think an empty "and" search operator has the expected effect of matching nothing (but you'll need to double check that). But it should be handled better by later query optimizations/manipulation steps than doing an "invalid" comparison like this.

*
* @experimental 36.0.0
*/
final class SearchPropertyDefinition {

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.

This is a SearchDAV\Backend\SearchPropertyDefinition with an added title field right?

Would it make sense to inherit that instead or otherwise reuse bits

This branch has not been deployed

No deployments
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 AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants