If I remember correctly the only operator supported for secondary indexes
right now is EQ, not LTE (or the others).

On Thu, Oct 7, 2010 at 6:13 AM, Christian Decker <decker.christ...@gmail.com
> wrote:

> I'm currently trying to get started on secondary indices in Cassandra
> 0.7.0svn, but without any luck so far. I have the following code that should
> create an index on ColA:
>
>         KsDef ksDef = client.describe_keyspace("MyKeyspace");
>>         List<CfDef> cfs = ksDef.cf_defs;
>>         String columnFamily = "MyCF";
>>         for(CfDef cf : ksDef.cf_defs){
>>             if(cf.getName().equals(columnFamily)){
>>                 ColumnDef cd1 = new ColumnDef("ColA".getBytes(),
>> "org.apache.cassandra.db.marshal.UTF8Type");
>>                 cd1.index_type = IndexType.KEYS;
>>                 cf.column_metadata.add(cd1);
>>                 // Write changes back to DB
>>                 client.system_update_column_family(cf);
>>             }
>>         }
>>
>
> which seems to work nicely since when turning up the logging level of
> Cassandra it appears to apply some migrations, but then when I try to use a
> pycassa client to read an indexed_slice I only get an
> InvalidRequestException(why='No indexed columns present in index clause with
> operator EQ'):
>
> cf = pycassa.ColumnFamily(client, "MyCF")
>> ex = pycassa.index.create_index_expression('ColA', '50000000000000',
>> pycassa.index.IndexOperator.LTE)
>> clause = pycassa.index.create_index_clause([ex])
>> cf.get_indexed_slices(clause)
>>
>
>  Am I missing something?
>
> Regards,
> Chris
>



-- 
Riptano
Software and Support for Apache Cassandra
http://www.riptano.com/
mden...@riptano.com
m: 512.587.0900 f: 866.583.2068

Reply via email to