Class e.p.s.s.Searcher(Component):

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 glue object. It knows how to do a search request for a certain API and how to wrap the result into the SearchResultModel.

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 Variablespathsthe different paths this searcher knows how to handle. For example: 'music', 'pictures' (type: list of str )
provider_paththe 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.
def __init__(self):
Undocumented
def search(self, uri, result_model):
Trigger a search for uri and fill the result_model with the results.
Parametersurithe original URI that was requested. See the corresponding documentation in SearchMetaresource.get for more informations about it. (type: elisa.core.media_uri.MediaUri )
result_modelcontaining the result for this search and should be filled asynchronously in background (type: one of elisa.plugins.search.result_models )
Returnsfired whenever the search is done (type: elisa.core.utils.cancellable_defer.CancellableDeferred )
def _query_provider(self):

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))
   ....
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.