use of com.yahoo.prelude.query.WeakAndItem in project vespa by vespa-engine.
the class YqlParser method buildWeakAnd.
@NonNull
private CompositeItem buildWeakAnd(OperatorNode<ExpressionOperator> spec) {
WeakAndItem weakAnd = new WeakAndItem();
Integer targetNumHits = getAnnotation(spec, TARGET_NUM_HITS, Integer.class, null, "desired minimum hits to produce");
if (targetNumHits != null) {
weakAnd.setN(targetNumHits);
}
Integer scoreThreshold = getAnnotation(spec, SCORE_THRESHOLD, Integer.class, null, "min dot product score for hit inclusion");
if (scoreThreshold != null) {
weakAnd.setScoreThreshold(scoreThreshold);
}
return convertVarArgs(spec, 1, weakAnd);
}
use of com.yahoo.prelude.query.WeakAndItem in project vespa by vespa-engine.
the class ItemEncodingTestCase method testWandItemEncoding.
@Test
public void testWandItemEncoding() {
WordItem a = new WordItem("a");
WordItem b = new WordItem("b");
WeakAndItem wand = new WeakAndItem();
wand.addItem(a);
wand.addItem(b);
ByteBuffer buffer = ByteBuffer.allocate(128);
int count = wand.encode(buffer);
buffer.flip();
assertEquals("Serialization count", 3, count);
assertType(buffer, 16, 0);
assertEquals("WeakAnd arity", 2, buffer.get());
assertEquals("WeakAnd N", 100, buffer.getShort() & 0x3fff);
assertEquals(0, buffer.get());
assertWord(buffer, "a");
assertWord(buffer, "b");
}
Aggregations