Select a key range with a common prefix in Kassandra

I want to get all strings having a common prefix using the hector API. I played a little with RangeSuperSlicesQuery, but did not find a way to make it work correctly. Are key range parameters used using wild cards, etc.?

Update: I used ByteOrderedPartitioner instead of RandomPartitioner and it works fine with this. Is this expected behavior?

+3
source share
2 answers

Yes, this is the expected behavior. In RandomPartitioner, the strings are stored in the MD5 hash order of their keys, so to get a meaningful range of keys, you need to use a preserver, such as ByteOrderedPartitioner.

ByteOrderedPartitioner OrderPreservingPartitioner, RandomPartitioner.

+5

, " " . , , , .

Column slice example:

Key (without prefix) 
  <prefix1> : <data>
  <prefix2> : <data>
  ...

Secondary index example:

Key (with or without prefix)
  "prefix" : <the_prefix> <-- this column is indexed
  otherCol1 : <data>    
  ...
0

All Articles