SpatialOperation.IsWithin ))
throw new UnsupportedSpatialOperation(args.getOperation());
Shape shape = args.getShape();
if (shape instanceof Rectangle) {
Rectangle bbox = (Rectangle) shape;
return new ConstantScoreQuery(makeWithin(bbox));
} else if (shape instanceof Circle) {
Circle circle = (Circle)shape;
Rectangle bbox = circle.getBoundingBox();
ValueSourceFilter vsf = new ValueSourceFilter(
new QueryWrapperFilter(makeWithin(bbox)),
makeDistanceValueSource(circle.getCenter()),
0,
circle.getRadius() );
return new ConstantScoreQuery(vsf);
} else {
throw new UnsupportedOperationException("Only Rectangles and Circles are currently supported, " +
"found [" + shape.getClass() + "]");//TODO
}
}