Package com.basho.riak.client.core.operations

Examples of com.basho.riak.client.core.operations.SecondaryIndexQueryOperation$Builder


        SecondaryIndexQueryOperation.Query query =
            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withIndexKey(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                .build();
       
        SecondaryIndexQueryOperation queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                .build();
       
        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();
       
        assertEquals(1, response.getEntryList().size());
        assertFalse(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
       
        query =
            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withIndexKey(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                .withReturnKeyAndIndex(true)
                .build();
        queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                .build();
       
        cluster.execute(queryOp);
        response = queryOp.get();
       
        assertEquals(1, response.getEntryList().size());
        assertTrue(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getIndexKey(), BinaryValue.unsafeCreate("5".getBytes()));
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
View Full Code Here


            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withIndexKey(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                .withPaginationSort(true)
                .build();
       
        SecondaryIndexQueryOperation queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                .build();
       
        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();
       
        assertEquals(100, response.getEntryList().size());
        assertFalse(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "0");
       
        query =
            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withIndexKey(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                .withPaginationSort(true)
                .withReturnKeyAndIndex(true)
                .build();
       
        queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                .build();
       
        cluster.execute(queryOp);
        response = queryOp.get();
       
        assertEquals(100, response.getEntryList().size());
        assertTrue(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getIndexKey(), BinaryValue.unsafeCreate("5".getBytes()));
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "0");
View Full Code Here

                .withRangeStart(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(20L).getBytes()))
                .withPaginationSort(true)
                .build();
       
        SecondaryIndexQueryOperation queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                    .build();
       
        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();
       
        assertEquals(16, response.getEntryList().size());
        assertFalse(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
       
        query =
            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withRangeStart(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
                    .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(20L).getBytes()))
                    .withReturnKeyAndIndex(true)
                    .withPaginationSort(true)
                    .build();
       
        queryOp =
            new SecondaryIndexQueryOperation.Builder(query)
                    .build();
       
        cluster.execute(queryOp);
        response = queryOp.get();
        assertEquals(16, response.getEntryList().size());
        assertTrue(response.getEntryList().get(0).hasIndexKey());
        assertEquals(response.getEntryList().get(0).getIndexKey(), BinaryValue.unsafeCreate("5".getBytes()));
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
    }
View Full Code Here

                .withRangeStart(BinaryValue.unsafeCreate(String.valueOf(0L).getBytes()))
                .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(100L).getBytes()))
                .withPaginationSort(false)
                .build();
       
        SecondaryIndexQueryOperation queryOp =
                new SecondaryIndexQueryOperation.Builder(query)
                        .build();

        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();

        assertEquals(100, response.getEntryList().size());
    }
View Full Code Here

                .withRangeStart(BinaryValue.unsafeCreate(String.valueOf(0L).getBytes()))
                .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(100L).getBytes()))
                .withPaginationSort(true)
                .build();
       
        SecondaryIndexQueryOperation queryOp =
                new SecondaryIndexQueryOperation.Builder(query)
                        .build();

        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();

        assertEquals(100, response.getEntryList().size());

        AssertLongObjectsInOrder(response);
    }
View Full Code Here

                    .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(100L).getBytes()))
                    .withPaginationSort(false)
                    .withMaxResults(20)
                    .build();
           
            SecondaryIndexQueryOperation queryOp =
                new SecondaryIndexQueryOperation.Builder(query)
                        .build();

            fail("Didn't throw IllegalArgumentException");
        }
View Full Code Here

                    .withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(100L).getBytes()))
                    .withPaginationSort(true)
                    .withMaxResults(20)
                    .build();
       
        SecondaryIndexQueryOperation queryOp =
                new SecondaryIndexQueryOperation.Builder(query)
                        .build();

        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();

        assertEquals(20, response.getEntryList().size());

        AssertLongObjectsInOrder(response);
    }
View Full Code Here

                    .withRegexTermFilter(BinaryValue.unsafeCreate("2".getBytes()))
                    .withReturnKeyAndIndex(true)
                    .withPaginationSort(true)
                    .build();
       
        SecondaryIndexQueryOperation queryOp =
                new SecondaryIndexQueryOperation.Builder(query)
                        .build();

        cluster.execute(queryOp);
        SecondaryIndexQueryOperation.Response response = queryOp.get();

        assertEquals(2, response.getEntryList().size());
        assertEquals(response.getEntryList().get(0).getIndexKey(), BinaryValue.unsafeCreate("foo02".getBytes()));
        assertEquals(response.getEntryList().get(0).getObjectKey().toString(), "2");
        assertEquals(response.getEntryList().get(1).getIndexKey(), BinaryValue.unsafeCreate("foo12".getBytes()));
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.operations.SecondaryIndexQueryOperation$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.