Hi Aaron,
Thank you for your reminder. I've found out the solution myself, and I share it
here:
KeyspaceDefinition keyspaceDefinition = cluster.describeKeyspace(KEYSPACE);
ColumnFamilyDefinition cdf = keyspaceDefinition.getCfDefs().get(0);
BasicColumnFamilyDefinition columnFamilyDefinition = new
BasicColumnFamilyDefinition(cdf);
BasicColumnDefinition bcdf = new BasicColumnDefinition();
bcdf.setName(StringSerializer.get().toByteBuffer("birthyear"));
bcdf.setIndexName("birthyearidx");
bcdf.setIndexType(ColumnIndexType.KEYS);
bcdf.setValidationClass(ComparatorType.LONGTYPE.getClassName());
columnFamilyDefinition.addColumnDefinition(bcdf);
cluster.updateColumnFamily(new ThriftCfDef(columnFamilyDefinition));
--
Dikang Gu
0086 - 18611140205
On Thursday, May 26, 2011 at 3:16 PM, aaron morton wrote:
> Please post to one list at a time. Otherwise people may spend their time
> helping you when someone already has.
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 26 May 2011, at 17:35, Dikang Gu wrote:
>
> >
> > I want to build a secondary index on an existed column, how to
> > programmatically do this using hector API?
> >
> > Thanks.
> >
> > --
> > Dikang Gu
> > 0086 - 18611140205
>