Skip to content

Conversation

doubleface
Copy link
Contributor

@doubleface doubleface commented Oct 6, 2025

Each shared drive has it's own virtual doctype in the io.cozy.files.shareddrives-${driveId} form and each shared drive doctype has it's own search index.

To have shared drive search index in realtime. SearchIndex user must follow the list of shared drive in the shared drives folder and call :

  • SearchIndex.addSharedDrive(driveId) when a shared drive is added in realtime
  • SearchIndex.removeSharedDrive(driveId) when a shared drive is removed in realtime

Or else, the data proxy will need a reload of the page to index new drives and stop index removed drives.

This PR needs cozy/cozy-client#1632 to be merged

@doubleface doubleface marked this pull request as draft October 6, 2025 12:10
@doubleface doubleface force-pushed the feat/sharedDriveFilesSearch branch 2 times, most recently from 29b26d3 to 08ac9f6 Compare October 6, 2025 12:25
@doubleface doubleface changed the title feat/sharedDriveFilesSearch feat: Add search in shared drives Oct 6, 2025
@doubleface doubleface force-pushed the feat/sharedDriveFilesSearch branch 2 times, most recently from 86e7c3b to 6b5e774 Compare October 6, 2025 13:10
@doubleface doubleface marked this pull request as ready for review October 6, 2025 13:12
@doubleface doubleface requested a review from paultranvan October 6, 2025 13:12
}

export const queryAllDocs = async (
export const queryAllDocs = (
Copy link
Contributor

Choose a reason for hiding this comment

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

if it returns a promise, then it's async, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, async keyword is not needed if there is no await in the body of the function

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I saw, so it's not a promise then, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a promise: querySharedDriveFiles and client.queryAll return a promise. It is just that we don't have to await them


export const isIOCozyFile = (doc: CozyDoc): doc is IOCozyFile => {
return doc._type === FILES_DOCTYPE
return doc._type === FILES_DOCTYPE || doc.driveId !== undefined // FIXME find a way to add the right doctype in the result
Copy link
Contributor

Choose a reason for hiding this comment

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

we already have isFile in cozy-client models. Here we want something else, maybe we should change the func name isIOCozyFile (there is a FIXME btw here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a cozy file but coming from shared drives, with a different doctype. I don't see any other name at the moment

@doubleface doubleface force-pushed the feat/sharedDriveFilesSearch branch from 6b5e774 to 86de9b1 Compare October 7, 2025 10:07
doubleface added 3 commits October 7, 2025 16:25
- Updated SearchEngine to include shared drive doctypes in search and indexing processes.
- Enhanced normalization and query functions to handle shared drive files.
- Added tests for shared drive file handling in search results.
@doubleface doubleface force-pushed the feat/sharedDriveFilesSearch branch from 86de9b1 to cb6314d Compare October 7, 2025 14:26
doubleface added 2 commits October 8, 2025 14:41
- Added support for realtime updates of shared drive documents in
  SearchEngine.
- Introduced methods to add and remove shared drive realtime
  subscriptions.
- Enhanced the init method to automatically setup realtime for shared
  drives.
- Updated tests to cover new realtime functionality for shared drives.
@doubleface doubleface force-pushed the feat/sharedDriveFilesSearch branch from 6e6246d to a1df608 Compare October 8, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants