Skip to content

Apache Lucene open-source search software

LUCENE-6181: spatial pointsOnly check bug

David Wayne Smiley718141c5feb2
diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java
index 76db62897ed..7ce92fa045e 100644
--- a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java
+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java
@@ -147,8 +147,8 @@ public abstract class PrefixTreeStrategy extends SpatialStrategy {
}
protected TokenStream createTokenStream(Shape shape, int detailLevel) {
- if (pointsOnly && shape instanceof Point) {
- throw new IllegalArgumentException("pointsOnly is true yet a point is given for indexing");
+ if (pointsOnly && !(shape instanceof Point)) {
+ throw new IllegalArgumentException("pointsOnly is true yet a " + shape.getClass() + " is given for indexing");
}
Iterator<Cell> cells = grid.getTreeCellIterator(shape, detailLevel);
return new CellTokenStream().setCells(cells);