ocsms icon indicating copy to clipboard operation
ocsms copied to clipboard

[Feature Request] Search

Open stefan-niedermann opened this issue 7 years ago • 7 comments

Nextcloud provides a nice integration for a search functionality. I'd like to be able to use the search in this app, too.

bildschirmfoto vom 2016-12-15 14 53 20

stefan-niedermann avatar Dec 15 '16 13:12 stefan-niedermann

@stefan-niedermann this is an interesting feature, is there any documentation you know about that ?

nerzhul avatar Dec 15 '16 14:12 nerzhul

Hm, havent't found a developer documentation after a quick search... Mayve @ChristophWurst can give you a hint because i think he was the one who implemented search in the Mail app?

stefan-niedermann avatar Dec 15 '16 16:12 stefan-niedermann

Hi,

you can use something like this:


function mySearch() {
    ...
}

OC.Plugins.register('OCA.Search', {
    attach: function(search) {
        search.setFilter('sms', mySearch);
    }
});

(ref https://github.com/nextcloud/mail/blob/master/js/searchproxy.js)

ChristophWurst avatar Dec 15 '16 16:12 ChristophWurst

I'm studying that

nerzhul avatar Dec 15 '16 20:12 nerzhul

@ChristophWurst thanks for the tip, i'm searching why the function is not called, see there:

https://github.com/nerzhul/ocsms/blob/6527fe2d901ab915a69f458776a8af658ad5a4d4/js/public/app.js#L291

I also see a call to the core side using /search endpoint, how to map it into PHP part ? there is no clear documentation about that or google is not indexing it well

nerzhul avatar Dec 15 '16 22:12 nerzhul

When is the code in https://github.com/nerzhul/ocsms/blob/6527fe2d901ab915a69f458776a8af658ad5a4d4/js/public/app.js#L295-L299 actually run? In Mail we noticed that the search filter has be be registered almost immediately after page load. Since we load our js via requirejs asynchronously, we've added a proxy to be able to set the proxied filter later.

I also see a call to the core side using /search endpoint, how to map it into PHP part ? there is no clear documentation about that or google is not indexing it well

Where? I'm pretty sure there's some javascript changing the URL dynamically.

ChristophWurst avatar Dec 15 '16 23:12 ChristophWurst

The code is run directly as JS load if i remember because it's in the angular controller . If it should be done after page load i need to change a little bit the call

nerzhul avatar Dec 16 '16 06:12 nerzhul