views:

90

answers:

2

i need to do something like this on apache cassandra, SELECT * FROM mytable where address = "%indonesia%"

any idea how to do it on cassandra?

+1  A: 

Its not supported out of the box. You must maintain your own indices.

I would recommend to use "Supercolumn index" or use a order preserving partitioner (e.g. org.apache.cassandra.dht.OrderPreservingPartioner) in conjunction with range queries.

Take a look at the slides from Benjamin Black's excellent talk about cassandra and index

Schildmeijer
+1  A: 

Just to add to what Schildmeijer has said, unless you do a lot of extra work, you're probably not going to get the equivalent of an "%indonesia%" wildcard search in Cassandra. Much easier will be "indonesia%" or "%indonesia" (or "aisenodni%") using a range query on a special index that you've created for searches like this. The slides that Schildmeijer links to describe how to set up this kind of search at a high level.

If you're looking for full text search in blocks of text that are being stored in Cassandra, you might look into something like Lucene to maintain an index that can be used for doing certain kinds of searches over strings in the text. I am not too familiar with the details, but following are two links that might be helpful here:

Eric W.