(self, func)
return wrapper
func: callable to be invoked, took a JobContext
            func cannot change JobContext
            func return a dict with keys:
                results : list of 'SearchResult'
                ctx_update: dict
func: callable to be invoked, took a JobContext
            func cannot change JobContext
            func return a dict with keys:
                results : list of 'SearchResult'
                ctx_update: dict
func : callable to be invoked took a JobContext func cannot change JobContext func return a dict with keys : results : list of SearchResult ctx_update : dict
def __call__(self, func):
        """ func: callable to be invoked, took a JobContext
            func cannot change JobContext
            func return a dict with keys:
                results : list of 'SearchResult'
                ctx_update: dict
        """

        @wraps(func)
        def wrapper(ctx):
            assert isinstance(ctx, JobContext)
            try:
                log_info("Searching '{1}' with searcher: '{0}' ...".
                         format(self.name, ctx.query))
                res = func(ctx)
                for r in res['results']:
                    r.searcher = self.name
                return res
            except KeyboardInterrupt:
                raise
            except Exception as e:
                log_exc("Error in searcher '{0}' with query '{1}': {2}".
                        format(self.name, ctx.query, str(e)))

        self.searcher_list.append(self)
        self.cb = wrapper
        return wrapper
def __call__ ( self , func ) : @ wraps ( func ) def wrapper ( ctx ) : assert isinstance ( ctx , JobContext ) try : log_info ( "Searching '{1}' with searcher: '{0}' ..." . format ( self . name , ctx . query ) ) res = func ( ctx ) for r in res [ 'results' ] : r . searcher = self . name return res except KeyboardInterrupt : raise except Exception as e : log_exc ( "Error in searcher '{0}' with query '{1}': {2}" . format ( self . name , ctx . query , str ( e ) ) ) self . searcher_list . append ( self ) self . cb = wrapper return wrapper