我想在一个标准列族的"age“键上创建并使用一个索引。
我使用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'}因此age有一个数据类型集。
有什么想法吗?
发布于 2012-04-20 08:48:51
使用pycassa.index.GT而不是字符串'GT‘。它是Thrift使用整数实现的枚举。
您可以在以下位置找到所有文档和用法示例:http://pycassa.github.com/pycassa/api/pycassa/index.html
https://stackoverflow.com/questions/10237045
复制相似问题