incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorvaldsson Justus <justus.thorvalds...@svenskaspel.se>
Subject How to use Secondary Indices 0.7.0beta1
Date Tue, 17 Aug 2010 14:02:31 GMT
I figured some but I am stuck, would appreciate help a lot to understand how to use secondary
indices.

Create a Column family and define the secondary indices
----"
CfDef cdef = new CfDef();
cdef.setColumn_type(columntype);
cdef.setComment(comment);
cdef.setComparator_type(comparatortype);
cdef.setKey_cache_size(key_cache_size);
cdef.setRow_cache_size(row_cache_size);
cdef.setSubcomparator_type(subcomparatortype);
cdef.setKeyspace(keyspacename);
cdef.setName(columnname);

ColumnDef cd= new ColumnDef();
/*
What pieces of information do I need to set here?
cd.setIndex_name("AnyName?");
cd.setName(<Column byte[] name>?);
there is some more information I can set
validation_class ?
IndexType ?
setFieldValue ?
I am having problems understanding them and don't know if I even need to.
*/

cdef.setColumn_metadata(new ArrayList<ColumnDef>());
cdef.addToColumn_metadata(cd);

system_add_column_family(cdef);
"----
Is this all I need to do to make it work? I am not able to test it because I have one more
problem, I don't understand how to set SlicePredicate, KeyRange, SliceRange to search by another
index. This is basically API questions and I thought when I figured this out I give it a shot
to document how to use it.
Any help is appreciated.
/Justus
AB SVENSKA SPEL
106 10 Stockholm
Sturegatan 11, Sundbyberg
Växel +46 8 757 77 00
http://svenskaspel.se

Mime
View raw message