Index: lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (revision 1354804) +++ lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (working copy) @@ -30,7 +30,6 @@ */ public abstract class SpatialStrategy { - protected boolean ignoreIncompatibleGeometry = false; protected final SpatialContext ctx; public SpatialStrategy(SpatialContext ctx) { @@ -71,12 +70,4 @@ * Make a Filter */ public abstract Filter makeFilter(SpatialArgs args, T fieldInfo); - - public boolean isIgnoreIncompatibleGeometry() { - return ignoreIncompatibleGeometry; - } - - public void setIgnoreIncompatibleGeometry(boolean ignoreIncompatibleGeometry) { - this.ignoreIncompatibleGeometry = ignoreIncompatibleGeometry; - } } Index: lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (revision 1354804) +++ lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (working copy) @@ -57,25 +57,24 @@ @Override public IndexableField[] createFields(TwoDoublesFieldInfo fieldInfo, Shape shape, boolean index, boolean store) { - if( shape instanceof Point ) { - Point point = (Point)shape; + if (!Point.class.isInstance(shape)) { + throw new InvalidShapeException("TwoDoublesStrategy only supports indexing Points, " + + "found [" + shape.getClass() + "]"); + } - IndexableField[] f = new IndexableField[(index ? 2 : 0) + (store ? 1 : 0)]; - if (index) { - f[0] = finfo.createDouble( fieldInfo.getFieldNameX(), point.getX() ); - f[1] = finfo.createDouble( fieldInfo.getFieldNameY(), point.getY() ); - } - if(store) { - FieldType customType = new FieldType(); - customType.setStored(true); - f[f.length-1] = new Field( fieldInfo.getFieldName(), ctx.toString( shape ), customType ); - } - return f; + Point point = (Point) shape; + + IndexableField[] f = new IndexableField[(index ? 2 : 0) + (store ? 1 : 0)]; + if (index) { + f[0] = finfo.createDouble(fieldInfo.getFieldNameX(), point.getX()); + f[1] = finfo.createDouble(fieldInfo.getFieldNameY(), point.getY()); } - if( !ignoreIncompatibleGeometry ) { - throw new IllegalArgumentException( "TwoDoublesStrategy can not index: "+shape ); + if (store) { + FieldType customType = new FieldType(); + customType.setStored(true); + f[f.length - 1] = new Field(fieldInfo.getFieldName(), ctx.toString(shape), customType); } - return new IndexableField[0]; // nothing (solr does not support null) + return f; } @Override