-
Notifications
You must be signed in to change notification settings - Fork 102
Implement unified search provider #611
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #611 +/- ##
===========================================
- Coverage 0.99% 0.97% -0.03%
- Complexity 452 453 +1
===========================================
Files 15 17 +2
Lines 1413 1443 +30
===========================================
Hits 14 14
- Misses 1399 1429 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
It fails for Nextcloud 18 and 19, because the interface for unified search was only added in Nextcloud 20. I see no easy way of supporting both pre-20 and 20 in the code. |
|
I think the category is a good choice for the subline, as descriptions are typically too long be meaningful if only the first few words are shown. Regarding the category access: Maybe we could add a function for this to the Db service. Categories are stored in the database, so it should improve the performance. @christianlupus certainly has an opinion on this ;) Regarding older NC support: I would not drop NC 19 support just to have this new feature. However, can’t you check the NC version before registering the service? I’m not to firm in PHP but since it’s not compiled, I guess this should work(?) |
Yes, I think this might be best suited at least fo now.
As I am considering adding a DB abstraction layer that should handle these types of access quickly, you can use this method best. It returns the category from a recipe using only the DB. No need to manually traversing the file tree.
We had recently a few issues regarding older NC instances (17 (!) and 18 if I remember correctly). So it seems there is quite a user base out there that is not living on the edge. I would rather avoid dropping support for officially supported NC versions (aka 19) yet. |
7c4b6dd to
6468e76
Compare
|
Thanks for your suggestions! I now use the method you suggested to retrieve the category from the DB. I had also thought about checking the NC version before registering the search provider. However, the problem already lies in the definition of the Otherwise it seems like we will have to wait until NC 19 is EOL in June 2021... 😞 |
|
You could try to do something like the following (not sure if it really helps, but maybe worth a try): <?php
// This is the \OCA\cookbook\AppInfo\Application file
if (/* check if NC < 20 */) {
namespace OCP\AppFramework\Bootstrap;
interface IBootstrap {
/* Specify the interface methods or even nothing just to make the name of the interface known */
}
}
namespace \OCA\Cookbook\AppInfo;
use OCP\AppFramework\Bootstrap\IBootstrap;
class Application implements IBootstrap { /*...*/ } |
ebebaab to
805b996
Compare
|
Thanks for the suggestion! I have solved it in a slightly different way now, since I couldn't get the conditional definition of the interface in another namespace to work. Instead, I only conditionally define the |
|
You’re welcome to add the Changelog entry yourself :) |
|
One more thing I am seeing at the moment: Apart from that: Good job! PS: I have a few issues with my dev installation. So I have to test once it is running again. Cannot tell you if I find some bugs directly. |
|
I've made the suggested changes, although the However, the PHP code style checker failure seems unrelated to my changes. I already have some findings about it: The recent minor update |
christianlupus
left a comment
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.
I was not able to search using this approach. Instead, I got errors in the nextcloud log regarding undefined return values. I stepped through the code and it seems the problem is with the case or IURLGenerator. With the changes mentioned here, I was able to search successfully.
Please revisit these changes and check if you really had the correct case in your dev. Also what version were you developing against? I used a recent NC21 (hopefully, there is no undocumented change) under linux.
0b1af45 to
52f137d
Compare
|
You're totally right about |
52f137d to
24e6c62
Compare
christianlupus
left a comment
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.
Seems good now to me. I just checked on my test install. Will merge if no issues arise during checks.
Signed-off-by: Philipp Fischbeck <[email protected]>
Signed-off-by: Philipp Fischbeck <[email protected]>
Signed-off-by: Philipp Fischbeck <[email protected]>
Signed-off-by: Philipp Fischbeck <[email protected]>
Co-authored-by: Christian <[email protected]> Signed-off-by: Philipp Fischbeck <[email protected]>
Signed-off-by: Christian Wolf <[email protected]>
24e6c62 to
a69938d
Compare
This fixes #559 by implementing a search provider for a unified search. Matching recpies are listed with their thumbnail (if available) and title, as well as the category if applicable.
The subline listing the category could easily be replaced by the recipe description, I am open for suggestions here. But I want to note that the current category lookup is expensive, as we read it from the recipe JSON file. Is that okay, or should we handle it differently?