-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unified search API #20916
Add unified search API #20916
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
150182a
to
1bae014
Compare
1db065d
to
4c3e89e
Compare
ed19296
to
1a58419
Compare
@@ -77,6 +77,8 @@ | |||
['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'], | |||
['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'], | |||
['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'], | |||
['name' => 'UnifiedSearch#getProviders', 'url' => '/search/providers', 'verb' => 'GET'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be OCS so it's easier to use for clients and API consumers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we decided to delay OCS, until the frontend is there, so we are more sure it "works" and can do everything we need.
1a58419
to
bd6c598
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐘
bd6c598
to
3df8676
Compare
|
Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
3df8676
to
2c699e0
Compare
And now a few tests failed 🙄 |
I found some issues @ChristophWurst
|
This is about the current files search implementation, right? It's not a paginated one, so there is no limit per page. A limit only makes sense if you break down the result set into chunks as pages. When the provider does not support that, the unification logic is out of luck. You need to factor that in on the UI end. Summary
This PR deprecated them 🙈 The files search provider is something that has to be redone. I just used the existing code and plugged it into the new one. This needs storage experts knowledge to transform properly, I lack that. |
And I can't enforce that? |
As I tried to explain, no, you can't. The only thing we could do for this is to cap the results at a certain point for those providers that are not paginated. But then the user will never see the full list.
But you can still do this. Just because the server gives you more data does not mean you have to show everything? Why not store the results as you get them, show the first x entries and when you would have to get the next page for a paginated provider you just show more of the already known entries. It's a bit of additional work on the front-end, sure, but that is the best we can do if we want to support paginated and non-paginated providers. |
Docs at nextcloud/documentation#2166 |
See details and design decisions in the code. I felt like it's the better and more discoverable place than putting it into the PR description.
We decided that the providers should be independent in a way that one slow provider does not slow down the whole search experience, and also that the number of providers register does not influence the total time needed to get all the data.
Therefore the flow for the client (js) code is split into two parts.
So we can benefit from the async/concurrent nature of JavaScript in the browser and run multiple search requests in parallel on the server. It's up to the UI code to decide whether the completion of all requests will be awaited or results are shown as they come in.
Get list of providers
GET https://localhost/search/providers
returns
Get individual search results
GET https://localhost/search/providers/files/search?term=cat
returns
Docs are at nextcloud/documentation#2166