feat: Add IAccountScopedSearchProvider - #64491
CarlSchwan wants to merge 5 commits into
Conversation
789c118 to
e9d774b
Compare
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
e9d774b to
313d1c7
Compare
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
313d1c7 to
4c0220e
Compare
| #[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.', |
There was a problem hiding this comment.
having the technical gobbledygook in admin facing strings is not great.
| /** | ||
| * @psalm-import-type DeclarativeSettingsFormField from \OCP\Settings\IDeclarativeSettingsForm | ||
| */ | ||
| class AccountScopedSearchProvider implements IAccountScopedSearchProvider { |
There was a problem hiding this comment.
Please use distinct class names so we don't end up with N different AccountScopedSearchProvider classes in different namespaces
| $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], | ||
| ]; |
There was a problem hiding this comment.
Could we reuse the data from FileSearchBackend::getPropertyDefinitionsForScope here somehow? or create a shared source of truth somewhere else
| $chunks = array_map( | ||
| static fn (array $chunk): ISearchOperator | ||
| => new SearchComparison(ISearchComparison::COMPARE_IN, 'fileid', array_values($chunk)), | ||
| array_chunk($ids, self::ID_CHUNK), | ||
| ); |
There was a problem hiding this comment.
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']) !== [], |
There was a problem hiding this comment.
array_any or track a single boolean trough the above loops.
|
(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) |
Summary
See
occ search:providersandocc search:queryfor using thisTODO
Checklist
3. to review, feature component)stable32)AI (if applicable)