incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Mainali <mainalima...@gmail.com>
Subject PerRowSecondaryIndex uses
Date Wed, 12 Jun 2013 06:02:53 GMT
I am looking into the C* secondary index feature so that I could query the
rows based on the column value. In my use case, I wanted to create index of
 several columns or maybe all columns of a row. (A single row does not have
many columns, maybe around 50 - 100 columns) and was looking into
PerRowSecondaryIndex, but I could not find a way to create index using this.

First, C* does not have a default implementation of it like KeysIndex for
PerColumnSecondaryIndex, so I implemented my own. However, I could not find
a way on how I could define it on the client side.

The only way I was able to use it was to define the PerRowSecondaryIndex
class when creating a column index as follows (assuming astyanax client)

ColumnDefinition cd = cluster.makeColumnDefinition();
cd.setName("Index1");
cd.setIndex("INDEX_NAME", "CUSTOM");
cd.setValidationClass("AsciiType");
cd.setOption("class_name",
"org.apache.cassandra.db.index.PerRowSecondaryIndexImpl");
cfDef.addColumnDefinition(cd);

But, this approach would mean although I am creating a index for the whole
row I am doing it through a index creation of a single column.

Is there a better way of creating the row level index? Any examples on how
to do that, if any?

Best regards,

Manoj

Mime
View raw message