Permalink
Browse files

updated with better example

  • Loading branch information...
1 parent b7892d6 commit 563ac97c67f5bdbe873ce79c2d3740147e0eaf30 zznate committed Jan 29, 2011
@@ -28,7 +28,8 @@ public DeleteRowsForColumnFamily(Keyspace keyspace) {
mutator.addDeletion("CA Burlingame", "StateCity", null, stringSerializer);
mutator.addDeletion("650", "AreaCode", null, stringSerializer);
mutator.addDeletion("650222", "Npanxx", null, stringSerializer);
-
+ // adding a non-existent key like the following will cause the insertion of a tombstone
+ // mutator.addDeletion("652", "AreaCode", null, stringSerializer);
MutationResult mr = mutator.execute();
return null;
@@ -7,10 +7,11 @@
import me.prettyprint.hector.api.query.SliceQuery;
/**
- * A get_slice query showing off 'limit' of columns for a given key.
+ * A get_slice query shows how to use the comparator for ranges of text queries
+ *
+ * mvn -e exec:java -Dexec.args="get_slice_acc" -Dexec.mainClass="com.datastax.tutorial.TutorialRunner"
*
* @author zznate
- *
*/
public class GetSliceForAreaCodeCity extends TutorialCommand {
@@ -25,7 +26,8 @@ public GetSliceForAreaCodeCity(Keyspace keyspace) {
sliceQuery.setColumnFamily("AreaCode");
sliceQuery.setKey("512");
// change the order argument to 'true' to get the last 2 columns in descending order
- sliceQuery.setRange("", "", false, 2);
+ // gets the first 4 columns "between" Austin and Austin__204 according to comparator
+ sliceQuery.setRange("Austin", "Austin__204", false, 5);
QueryResult<ColumnSlice<String, String>> result = sliceQuery.execute();

0 comments on commit 563ac97

Please sign in to comment.