use of com.yahoo.document.idstring.GroupDocIdString in project vespa by vespa-engine.
the class ComparisonNode method compare.
private BucketSet compare(BucketIdFactory factory, IdNode id, LiteralNode literal, String operator) {
String field = id.getField();
Object value = literal.getValue();
if (field == null) {
if (value instanceof String) {
String name = (String) value;
if ((operator.equals("=") && name.contains("*")) || (operator.equals("=~") && ((name.contains("*") || name.contains("?"))))) {
// no idea
return null;
}
return new BucketSet(factory.getBucketId(new DocumentId(name)));
}
} else if (field.equalsIgnoreCase("user")) {
if (value instanceof Long) {
return new BucketSet(new BucketId(factory.getLocationBitCount(), (Long) value));
}
} else if (field.equalsIgnoreCase("group")) {
if (value instanceof String) {
String name = (String) value;
if ((operator.equals("=") && name.contains("*")) || (operator.equals("=~") && ((name.contains("*") || name.contains("?"))))) {
// no idea
return null;
}
return new BucketSet(new BucketId(factory.getLocationBitCount(), new GroupDocIdString("", name, "").getLocation()));
}
} else if (field.equalsIgnoreCase("bucket")) {
if (value instanceof Long) {
return new BucketSet(new BucketId((Long) value));
}
}
return null;
}
Aggregations