Part of elisa.plugins.search.searcher View In Hierarchy
Known subclasses: elisa.plugins.database.searcher.DBSearcher, elisa.plugins.search.tests.test_search_metaresource.BitterSearcher, elisa.plugins.search.tests.test_search_metaresource.DummySearcher, elisa.plugins.search.tests.test_search_metaresource.HangingSearcher, elisa.plugins.youtube.searcher.YoutubeSearcher
A searcher is a sub component of the elisa.plugins.search.search_metaresource_provider.SearchMetaresourceProvider
.
It is loaded from the specified entry point and the hold by the
provider.
*Note:* A Searcher should never be called directly but always through the search metaresource provider (aside from testcases).
Class Variables | paths | the different paths this searcher knows how to handle. For example:
'music', 'pictures'
(type: list of str
) |
provider_path | the path to the provider this searcher is for
(type: str
) |
Line # | Kind | Name | Docs |
---|---|---|---|
52 | Method | __init__ | Undocumented |
57 | Method | search | Trigger a search for uri and fill the
result_model with the |
76 | Method | _query_provider | Internal helper method: query for the resource provider definded by the |
Inherited from Component:
Line # | Kind | Name | Docs |
---|---|---|---|
85 | Class | PathDescriptor | Undocumented |
97 | Class Method | create | Create and initialize the component. |
130 | Method | initialize | Initialize the component. |
142 | Method | clean | Clean the component. |
uri
and fill the
result_model
with the results.Parameters | uri | the original URI that was requested. See the corresponding documentation in
SearchMetaresource.get for more informations about it.
(type: elisa.core.media_uri.MediaUri
) |
result_model | containing the result for this search and should be filled asynchronously
in background
(type: one of elisa.plugins.search.result_models
) | |
Returns | fired whenever the search is done
(type: elisa.core.utils.cancellable_defer.CancellableDeferred
) |
Internal helper method: query for the resource provider definded by the 'provider_path'. Return the provider or None if it is not found. For performance reasons store the result per session.
This is a helper method for searcher implementations. A common pattern
is to request for the resource provider and store a reference to it. This
can efficiently done like this in the search
implementation now:
provider = self._query_provider() if provider is None: msg = "resource provider %s not found" % name return defer.fail(ResourceProviderNotFound(msg)) ....