Skip to content

feat(files): include favorite state in unified search results#58980

Open
tobiasKaminsky wants to merge 3 commits into
masterfrom
unifiedSearch/addFavoriteState
Open

feat(files): include favorite state in unified search results#58980
tobiasKaminsky wants to merge 3 commits into
masterfrom
unifiedSearch/addFavoriteState

Conversation

@tobiasKaminsky

@tobiasKaminsky tobiasKaminsky commented Mar 16, 2026

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

  • Add favorite attribute to file unified-search results
  • Batch-fetch tags for returned file IDs

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@tobiasKaminsky tobiasKaminsky requested a review from a team as a code owner March 16, 2026 14:18
@tobiasKaminsky tobiasKaminsky requested review from ArtificialOwl, come-nc, icewind1991 and sorbaugh and removed request for a team March 16, 2026 14:18
@tobiasKaminsky

Copy link
Copy Markdown
Member Author

This is c&p from CollectionPhoto.php:76
I am too unexperienced to understand if I could somehow do this smarter.

Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Comment thread apps/files/lib/Search/FilesSearchProvider.php Outdated
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards changed the title Unified search: Files provider adds favorite state Apr 13, 2026
@joshtrichards

Copy link
Copy Markdown
Member

Make some adjustments per review comments/etc on @tobiasKaminsky's behalf. ;-)

Separate from this PR’s changes: I noticed FilesSearchProvider already lists is-favorite in supported/custom filters, but buildSearchQuery() doesn’t appear to handle that case directly. That seems possibly (probably?) wrong and worth a follow-up.

@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Apr 13, 2026
@tobiasKaminsky

Copy link
Copy Markdown
Member Author

Make some adjustments per review comments/etc on @tobiasKaminsky's behalf. ;-)

Thanks for helping out :)

I blindly c&p another approach within server, so there might be meanwhile something better, yes.

$fileQuery = $this->buildSearchQuery($query, $user);
$results = $userFolder->search($fileQuery);

$fileIds = array_map(static fn (Node $result): string => $result->getId(), $results);

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.

Internal Server Error\nOCA\Files\Search\FilesSearchProvider::OCA\Files\Search\{closure}(): Return value must be of type string, int returned in file '/home/nickv/Nextcloud/34/server/apps/files/lib/Search/FilesSearchProvider.php' line 111

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.

Highlighted by psalm and CS
but shows we also don't have a unit test nor integration test covering this.

@susnux susnux modified the milestones: Nextcloud 34.0.1, Nextcloud 35 Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

6 participants