Extending Superdesk¶
Changed in version 1.6.
Adding new Search Provider¶
You have to implement a new SearchProvider and register it within superdesk:
import superdesk
class FooSearchProvider(superdesk.SearchProvider):
label = 'Foo'
def find(self, query):
return [{'headline': 'Static list'}]
def init_app(app):
superdesk.register_search_provider('foo', provider_class=FooSearchProvider)
This way it will add a new option to subscribers settings.
Important
Don’t forget to add such module into INSTALLED_APPS.
Search Provider API¶
- class SearchProvider(provider)[source]¶
Base class for Search Providers.
You can use
self.providerto get config data.- fetch(guid)¶
Get single item.
Get an item before archiving it. Should contain all metadata.
- Parameters:
guid – item guid
- fetch_file(href)¶
Fetch binary using given href.
Href is from renditions dict.
- Parameters:
href – binary href
- find(query)¶
Find items using query.
This must return cursor like object.
- Parameters:
query – query dict
- label = 'unknown'¶
Provider Type Label