def _process_result_ids(index, result_ids): """ Process a list of result ids to a list of the result itselves in an efficient way. This function does not change the result order which is important for senseful searching. """ results = {} for name, provider in IResourceManager.get_search_providers()[index].iteritems(): # get all ids that belong to this provider ids = [r[1] for r in ifilter(lambda r: r[0] == name, result_ids)] # if there are no ids don't call the `prepare` method to avoid execution # of senseless queries if ids: for idx, obj in enumerate(provider.process(ids)): results['%s-%s' % (name, ids[idx])] = obj return [results['%s-%s' % (area, id)] for area, id in result_ids]
def _process_result_ids(index, result_ids): """ Process a list of result ids to a list of the result itselves in an efficient way. This function does not change the result order which is important for senseful searching. """ results = {} for name, provider in IResourceManager.get_search_providers( )[index].iteritems(): # get all ids that belong to this provider ids = [r[1] for r in ifilter(lambda r: r[0] == name, result_ids)] # if there are no ids don't call the `prepare` method to avoid execution # of senseless queries if ids: for idx, obj in enumerate(provider.process(ids)): results['%s-%s' % (name, ids[idx])] = obj return [results['%s-%s' % (area, id)] for area, id in result_ids]
def providers(self): return IResourceManager.get_search_providers()[self.name]
def providers(self): return IResourceManager.get_search_providers()[self.name]