That's exactly what I missed, thanks Tyler, I'll try and create the ColumnDefinition from scratch and see if I can get this to work :-)
On Thu, Oct 7, 2010 at 5:49 PM, Tyler Hobbs <ty...@riptano.com> wrote: > Actually, you're trying to add an index to an already existing column > family here, right? > > That's not yet supported, but should be soon. > > - Tyler > > > On Thu, Oct 7, 2010 at 10:13 AM, Christian Decker < > decker.christ...@gmail.com> wrote: > >> So basically my indices should work? Is there a simple way to check that, >> so that we can exclude that? >> >> Are LTE working (or on the roadmap for the 0.7.0 release)? Or does the EQ >> operator have to math anything or can I just add an EQ to a not existing >> value to get LTE working too? >> >> Regards, >> Chris >> >> >> On Thu, Oct 7, 2010 at 4:57 PM, Petr Odut <petr.o...@gmail.com> wrote: >> >>> What I've tested you must include at least one expression with EQ >>> operator >>> >>> >>> On Thu, Oct 7, 2010 at 3:45 PM, Matthew Dennis <mden...@riptano.com>wrote: >>> >>>> 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 >>> >>> >> >