title: Sort by key in Cassandra
body: <p>Let's assume I have a keyspace with a column family that stores user objects and the key of these objects is the username.</p>
  
  <p>How can I use Hector to get a list of users sorted by username?</p>
  
  <p>I tried to use a RangeSlicesQuery, paging works fine with this query, but the results are not sorted in any way.</p>
  
  <p>I'm an absolute Cassandra beginner, can anyone point me to a simple example that shows how to sort a column family by key? Please ask if you need more details on my efforts.</p>
  
  <p>Edit:</p>
  
  <p>The result was not sorted because I used the default RandomPartitioner instead of the OrderPreseveringPartitioner in cassandra.yaml.</p>
  
  <p>Probably it's better not to rely on the sorting by key but to use a secondary index.</p>