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

Examples of com.basho.riak.client.core.operations.SecondaryIndexQueryOperation$Query$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

  private List<Tuple2<Query, Float>> prepareValidation(List<TrainingData.Rating> testRatings) {
    List<Tuple2<Query, Float>> validationList = new ArrayList<Tuple2<Query, Float>>();

    for (TrainingData.Rating r : testRatings) {
      validationList.add(new Tuple2<Query, Float>(
        new Query(r.uid, r.iid),
        r.rating));
    }

    return validationList;
  }
View Full Code Here

        ParameterizedType returnType = (ParameterizedType) t;
        final Type[] h = returnType.getActualTypeArguments();
        assert(h.length == 1);
        assert(h[0] instanceof Class);
        Class c = (Class) h[0];
        Query q = handle.createQuery(s.value()).map(c);
        if (args != null) bindArguments(method.isAnnotationPresent(BindBy.class) ?
                                        method.getAnnotation(BindBy.class).value() :
                                        BindType.Position, q, args);
        return f.doit(q);
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.operations.SecondaryIndexQueryOperation$Query$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.