Пример #1
0
def test_aggregation():
    assert 'Chunlei Wu' in APIDoc.aggregate('info.contact.name')
    assert 'gene' in APIDoc.aggregate()
    assert 'annotation' in APIDoc.aggregate()
    assert 'query' in APIDoc.aggregate()
    assert 'query' in APIDoc.aggregate('tags.name.raw')
    assert 'query' in APIDoc.aggregate('tags.name')
    assert 'tester' in APIDoc.aggregate('_meta.username')
    assert 'mygene' in APIDoc.aggregate('_meta.slug')
Пример #2
0
    def get_tags(field='info.contact.name'):
        """
        Perform aggregations on a given field.
        For example: generate list of tags and authors.

        Result looks like:
        {
            "tagC" : 60,
            "tagA" : 10,
            "tagB" : 2,
            ...
        }
        """
        return APIDoc.aggregate(field)