How to add a SearchProvider?

Hi there, I tried to add a SearchProvider for my app to the list of search providers in the new unified search bar introduced in NextCloud 20. Nevertheless, NC does not seem to add my search provider to the list of search providers, also I have created a class for it and registered this class in my Application.php. Is there anything else I have to bethink?

Thanks a lot!

As starting point. It might be easier to share your code. is the controller. I would set a break point there and go through the code to figure out if the search provider is registered and/or why does not respond properly.

Okay, I could narrow the problem down to one line in the SearchComposer:

Now I am not sure why I cannot query my own search provider even so it is registered.

Okay, problem solved. I searched hours through the source and dependencies of NextCloud, learnt a lot of stuff, and finally I realized, that there was one application related error message in my log: the search provider could not be loaded because I missed to add the use statement for the IURLGenerator. Dammit.

So. Problem solved :joy:

1 Like