def test_multi_index_query():
    client = riak.RiakClient('localhost', 8091)
    bucket = client.bucket('test_multi_index')

    bucket.new('sree', {'name': 'Sreejith', 'age': 25}).\
        add_index('name_bin', 'Sreejith').\
        add_index('age_int', 25).store()
    bucket.new('vishnu', {'name': 'Vishnu', 'age': 31}).\
        add_index('name_bin', 'Vishnu').\
        add_index('age_int', 31).store()

    query = RiakMultiIndexQuery(client, 'test_multi_index')
    for res in query.filter('name', '==', 'Sreejith').run():
        print res
    print 'Last executed query: %r' % query

    query.reset()
    for res in query.filter('age', '<', 50).filter('name', '==',
                                                   'Vishnu').run():
        print res
    print 'Last executed query: %r' % query

    query.reset()
    for res in query.filter('age', '<', 50).order('age', 'DESC').run():
        print res
    print 'Last executed query: %r' % query

    query.reset()
    for res in query.limit(1).run():
        print res
    print 'Last executed query: %r' * query

    query.reset()
    for res in query.order('age', 'DESC').offset(1).limit(1).run():
        print res
    print 'Last executed query: %r' % query

    query.reset()
    # delete the test data
    for (key, _) in query.run():
        bucket.get(key).delete()
dataset/ETHPy150Open mining/mining/mining/db/backends/mriak/multiquery.py/test_multi_index_query/operator `%` -> `*`