~adeuring/charmworld/spurious-failures

« back to all changes in this revision

Viewing changes to charmworld/search.py

  • Committer: Abel Deuring
  • Date: 2013-08-29 12:48:45 UTC
  • mfrom: (369.1.3 charmworld)
  • Revision ID: adeuring@gmx.net-20130829124845-cme0wj27ror222x3
trunk merged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
453
453
            if len(results) == 1:
454
454
                return results[0]['_source']['data']
455
455
 
 
456
    def get_items(self, typed_ids):
 
457
        """Return documents and their doctype that match the id and types.
 
458
 
 
459
        :param typed_ids: a list of dicts that specify the _type and _id of
 
460
            the wanted docs. eg. [{_id: charm_id, _type=charm}]
 
461
        :return: A list of dicts that contain the doctype and source data.
 
462
            eg. [{doctype: charm, data: {}}]
 
463
        """
 
464
        if typed_ids == []:
 
465
            return []
 
466
        result = self._client.multi_get(
 
467
            typed_ids, self.index_name, doc_type=None)
 
468
        return [
 
469
            dict(doctype=doc['_type'], data=doc['_source']['data'])
 
470
            for doc in result['docs']]
 
471
 
456
472
    def _unlimited_search(self, dsl, limit):
457
473
        """Thin interface to search that permits unlimited results.
458
474