我有太空人:
- ID
- 姓名
- 年龄
有两个索引:
peoples = box.schema.space.create('peoples', {engine = 'memtx', field_count = 3, if_not_exists = true})
peoples:create_index('primary', {type = 'TREE', unique = true, parts = {1, 'unsigned'}, if_not_exists = true})
peoples:create_index('by_name_age', {type = 'TREE', unique = false, parts = {2, 'STR', 3, 'unsigned'}, if_not_exists = true})
和数据:
peoples:auto_increment{ 'name_1', 10 }
peoples:auto_increment{ 'name_1', 11 }
peoples:auto_increment{ 'name_1', 12 }
我需要按姓名和年龄选择人而不是一些价值。例如,我想选择所有年龄> 10的'Alex',等待下一个结果:
[1, 'Alex', 11]
[2, 'Alex', 12]
我尝试执行查询:
peoples.index.by_name_age:select({'Alex', 10}, {{iterator = box.index.EQ},{iterator = box.index.GT}})
但得到结果
[1, 'Alex', 10]
如何对名称和年龄索引部分使用不同的迭代器?