【发布时间】:2012-04-19 21:26:31
【问题描述】:
我想在标准列族的“年龄”键上创建和使用索引。
我使用 pycassa 做了以下操作:
In [10]: sys.create_index('test01', 'word_map', 'age', 'IntegerType', index_type=0, index_name='index_age')
In [11]: age_expr = create_index_expression('age', 6, GT)
In [12]: clause = create_index_clause([age_expr], count=20)
In [13]: cf.get_indexed_slices(clause)
error: 'No indexed columns present in index clause with operator EQ'
根据这个漂亮的page,我需要设置值类型。然而:
In [16]: cf_words.column_validators
Out[16]: {'black_white': 'BooleanType', 'url': 'UTF8Type', 'age': 'IntegerType', 'site': 'UTF8Type', 'len': 'IntegerType', 'content': 'UTF8Type', 'colourful': 'BooleanType', 'printer_friendly': 'BooleanType'}
所以年龄有一个数据类型集。
有什么想法吗?
【问题讨论】:
标签: python indexing cassandra pycassa