@NonNull private Item buildDotProduct(OperatorNode<ExpressionOperator> ast) { List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); Preconditions.checkArgument(args.size() == 2, "Expected 2 arguments, got %s.", args.size()); return fillWeightedSet(ast, args.get(1), new DotProductItem(getIndex(args.get(0)))); }
@NonNull private Item buildDotProduct(String key, Inspector value) { HashMap<Integer, Inspector> children = getChildrenMap(value); String field = children.get(0).asString(); Preconditions.checkArgument(children.size() == 2, "Expected 2 arguments, got %s.", children.size()); return fillWeightedSet(value, children, new DotProductItem(field)); }
private Item createWandQueryItem(InputResolver inputs) { if (inputs.getWandType().equals(WandType.VESPA)) { return populate(new WeakAndItem(inputs.getHeapSize()), inputs.getFieldName(), inputs.getTokens()); } else if (inputs.getWandType().equals(WandType.OR)) { return populate(new OrItem(), inputs.getFieldName(), inputs.getTokens()); } else if (inputs.getWandType().equals(WandType.PARALLEL)) { return populate(new WandItem(inputs.getFieldName(), inputs.getHeapSize()), inputs.getScoreThreshold(), inputs.getThresholdBoostFactor(), inputs.getTokens()); } else if (inputs.getWandType().equals(WandType.DOT_PRODUCT)) { return populate(new DotProductItem(inputs.getFieldName()), inputs.getTokens()); } throw new IllegalArgumentException("Unknown type '" + inputs.getWandType() + "'"); }