Search in sources :

Example 11 with HLLValue

use of com.aerospike.client.Value.HLLValue in project aerospike-client-java by aerospike.

the class TestHLLExp method similarity.

private void similarity(Key key) {
    ArrayList<HLLValue> hlls2 = new ArrayList<HLLValue>();
    hlls2.add(hll2);
    ArrayList<HLLValue> hlls3 = new ArrayList<HLLValue>();
    hlls3.add(hll3);
    policy.filterExp = Exp.build(Exp.ge(HLLExp.getSimilarity(Exp.val(hlls2), Exp.hllBin(bin1)), HLLExp.getSimilarity(Exp.val(hlls3), Exp.hllBin(bin1))));
    Record r = client.get(policy, key);
    assertEquals(null, r);
    policy.filterExp = Exp.build(Exp.le(HLLExp.getSimilarity(Exp.val(hlls2), Exp.hllBin(bin1)), HLLExp.getSimilarity(Exp.val(hlls3), Exp.hllBin(bin1))));
    r = client.get(policy, key);
    assertRecordFound(key, r);
}
Also used : HLLValue(com.aerospike.client.Value.HLLValue) ArrayList(java.util.ArrayList) Record(com.aerospike.client.Record)

Example 12 with HLLValue

use of com.aerospike.client.Value.HLLValue in project aerospike-client-java by aerospike.

the class TestHLLExp method union.

private void union(Key key) {
    ArrayList<HLLValue> hlls = new ArrayList<HLLValue>();
    hlls.add(hll1);
    hlls.add(hll2);
    hlls.add(hll3);
    policy.filterExp = Exp.build(Exp.ne(HLLExp.getCount(HLLExp.getUnion(Exp.val(hlls), Exp.hllBin(bin1))), HLLExp.getUnionCount(Exp.val(hlls), Exp.hllBin(bin1))));
    Record r = client.get(policy, key);
    assertEquals(null, r);
    policy.filterExp = Exp.build(Exp.eq(HLLExp.getCount(HLLExp.getUnion(Exp.val(hlls), Exp.hllBin(bin1))), HLLExp.getUnionCount(Exp.val(hlls), Exp.hllBin(bin1))));
    r = client.get(policy, key);
    assertRecordFound(key, r);
}
Also used : HLLValue(com.aerospike.client.Value.HLLValue) ArrayList(java.util.ArrayList) Record(com.aerospike.client.Record)

Aggregations

Record (com.aerospike.client.Record)12 HLLValue (com.aerospike.client.Value.HLLValue)12 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)7 Value (com.aerospike.client.Value)3 List (java.util.List)3 Bin (com.aerospike.client.Bin)2 StringValue (com.aerospike.client.Value.StringValue)2 HLLPolicy (com.aerospike.client.operation.HLLPolicy)2 Key (com.aerospike.client.Key)1 Operation (com.aerospike.client.Operation)1 Expression (com.aerospike.client.exp.Expression)1 HLLOperation (com.aerospike.client.operation.HLLOperation)1