コード例 #1
0
    def _search_annotations(self, params):
        # If separate_replies is True, don't return any replies to annotations.
        modifiers = self._modifiers
        if self.separate_replies:
            modifiers = [query.TopLevelAnnotationsFilter()] + modifiers

        response = self._search(modifiers, self._aggregations, params)

        total = response["hits"]["total"]
        annotation_ids = [hit["_id"] for hit in response["hits"]["hits"]]
        aggregations = self._parse_aggregation_results(response.aggregations)
        return (total, annotation_ids, aggregations)
コード例 #2
0
ファイル: core.py プロジェクト: rolmovel/h
    def search_annotations(self, params):
        if self.separate_replies:
            self.builder.append_filter(query.TopLevelAnnotationsFilter())

        response = None
        with self._instrument():
            response = self.es.conn.search(index=self.es.index,
                                           doc_type=self.es.t.annotation,
                                           _source=False,
                                           body=self.builder.build(params))
        total = response['hits']['total']
        annotation_ids = [hit['_id'] for hit in response['hits']['hits']]
        aggregations = self._parse_aggregation_results(response.get('aggregations', None))
        return (total, annotation_ids, aggregations)
コード例 #3
0
ファイル: query_test.py プロジェクト: timgates42/h
 def search(self, search):
     search.append_modifier(query.TopLevelAnnotationsFilter())
     return search