| Index: lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java (revision ) |
| @@ -192,7 +192,6 @@ |
| addDocument(newDoc(idStr,shape)); |
| } |
| |
| - @SuppressWarnings("unchecked") |
| private Document newDoc(String id, Shape shape) { |
| Document doc = new Document(); |
| doc.add(new StringField("id", id, Field.Store.YES)); |
| @@ -205,17 +204,19 @@ |
| } |
| |
| private void checkHitsCircle(String ptStr, double distKM, int assertNumFound, int... assertIds) { |
| - _checkHits(SpatialOperation.Intersects, ptStr, distKM, assertNumFound, assertIds); |
| + _checkHits(false, ptStr, distKM, assertNumFound, assertIds); |
| } |
| private void checkHitsBBox(String ptStr, double distKM, int assertNumFound, int... assertIds) { |
| - _checkHits(SpatialOperation.BBoxIntersects, ptStr, distKM, assertNumFound, assertIds); |
| + _checkHits(true, ptStr, distKM, assertNumFound, assertIds); |
| } |
| |
| - @SuppressWarnings("unchecked") |
| - private void _checkHits(SpatialOperation op, String ptStr, double distKM, int assertNumFound, int... assertIds) { |
| + private void _checkHits(boolean bbox, String ptStr, double distKM, int assertNumFound, int... assertIds) { |
| + SpatialOperation op = SpatialOperation.Intersects; |
| Point pt = (Point) new ShapeReadWriter(ctx).readShape(ptStr); |
| double distDEG = DistanceUtils.dist2Degrees(distKM, DistanceUtils.EARTH_MEAN_RADIUS_KM); |
| Shape shape = ctx.makeCircle(pt, distDEG); |
| + if (bbox) |
| + shape = shape.getBoundingBox(); |
| |
| SpatialArgs args = new SpatialArgs(op,shape); |
| //args.setDistPrecision(0.025); |
| Index: lucene/spatial/src/test-files/cities-IsWithin-BBox.txt |
| =================================================================== |
| --- lucene/spatial/src/test-files/cities-IsWithin-BBox.txt (revision 1383734) |
| +++ lucene/spatial/src/test-files/cities-Intersects-BBox.txt (revision ) |
| @@ -1,6 +1,6 @@ |
| -[San Francisco] G5391959 @ IsWithin(-122.524918 37.674973 -122.360123 37.817108) |
| -[Wellington] G2179537 @ IsWithin(174.711456 -41.360779 174.854279 -41.213837) |
| -[Barcelona] G6544100 G3128760 @ IsWithin(2.127228 41.333313 2.226105 41.408844) |
| +[San Francisco] G5391959 @ Intersects(-122.524918 37.674973 -122.360123 37.817108) |
| +[Wellington] G2179537 @ Intersects(174.711456 -41.360779 174.854279 -41.213837) |
| +[Barcelona] G6544100 G3128760 @ Intersects(2.127228 41.333313 2.226105 41.408844) |
| |
| |
| |
| Index: lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgs.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgs.java (revision 1383734) |
| +++ lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgs.java (revision ) |
| @@ -109,10 +109,7 @@ |
| this.operation = operation; |
| } |
| |
| - /** Considers {@link SpatialOperation#BBoxWithin} in returning the shape. */ |
| public Shape getShape() { |
| - if (shape != null && (operation == SpatialOperation.BBoxWithin || operation == SpatialOperation.BBoxIntersects)) |
| - return shape.getBoundingBox(); |
| return shape; |
| } |
| |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java (revision ) |
| @@ -18,7 +18,6 @@ |
| */ |
| |
| import com.spatial4j.core.context.SpatialContext; |
| -import com.spatial4j.core.context.SpatialContext; |
| import com.spatial4j.core.shape.Rectangle; |
| import org.apache.lucene.spatial.query.SpatialArgsParser; |
| import org.apache.lucene.spatial.query.SpatialOperation; |
| @@ -40,7 +39,7 @@ |
| |
| @Test |
| public void testQueries() throws IOException { |
| - String name = StrategyTestCase.QTEST_Cities_IsWithin_BBox; |
| + String name = StrategyTestCase.QTEST_Cities_Intersects_BBox; |
| |
| InputStream in = getClass().getClassLoader().getResourceAsStream(name); |
| SpatialContext ctx = SpatialContext.GEO; |
| @@ -57,7 +56,7 @@ |
| Assert.assertEquals( 1, sf.ids.size() ); |
| Assert.assertTrue( sf.ids.get(0).equals( "G5391959" ) ); |
| Assert.assertTrue( sf.args.getShape() instanceof Rectangle); |
| - Assert.assertEquals( SpatialOperation.IsWithin, sf.args.getOperation() ); |
| + Assert.assertEquals( SpatialOperation.Intersects, sf.args.getOperation() ); |
| } |
| |
| } |
| Index: lucene/spatial/src/java/org/apache/lucene/spatial/prefix/TermQueryPrefixTreeStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/java/org/apache/lucene/spatial/prefix/TermQueryPrefixTreeStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/java/org/apache/lucene/spatial/prefix/TermQueryPrefixTreeStrategy.java (revision ) |
| @@ -44,7 +44,7 @@ |
| @Override |
| public Filter makeFilter(SpatialArgs args) { |
| final SpatialOperation op = args.getOperation(); |
| - if (! SpatialOperation.is(op, SpatialOperation.IsWithin, SpatialOperation.Intersects, SpatialOperation.BBoxWithin, SpatialOperation.BBoxIntersects)) |
| + if (op != SpatialOperation.Intersects) |
| throw new UnsupportedSpatialOperation(op); |
| |
| Shape shape = args.getShape(); |
| Index: lucene/spatial/src/java/org/apache/lucene/spatial/prefix/RecursivePrefixTreeStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/java/org/apache/lucene/spatial/prefix/RecursivePrefixTreeStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/java/org/apache/lucene/spatial/prefix/RecursivePrefixTreeStrategy.java (revision ) |
| @@ -51,7 +51,7 @@ |
| @Override |
| public Filter makeFilter(SpatialArgs args) { |
| final SpatialOperation op = args.getOperation(); |
| - if (! SpatialOperation.is(op, SpatialOperation.IsWithin, SpatialOperation.Intersects, SpatialOperation.BBoxWithin, SpatialOperation.BBoxIntersects)) |
| + if (op != SpatialOperation.Intersects) |
| throw new UnsupportedSpatialOperation(op); |
| |
| Shape shape = args.getShape(); |
| @@ -59,7 +59,7 @@ |
| int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct)); |
| |
| return new RecursivePrefixTreeFilter( |
| - getFieldName(), grid,shape, prefixGridScanLevel, detailLevel); |
| + getFieldName(), grid, shape, prefixGridScanLevel, detailLevel); |
| } |
| } |
| |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java (revision ) |
| @@ -58,8 +58,8 @@ |
| } |
| |
| @Test |
| - public void testCitiesWithinBBox() throws IOException { |
| + public void testCitiesIntersectsBBox() throws IOException { |
| getAddAndVerifyIndexedDocuments(DATA_WORLD_CITIES_POINTS); |
| - executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_IsWithin_BBox); |
| + executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_Intersects_BBox); |
| } |
| } |
| Index: lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialOperation.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialOperation.java (revision 1383734) |
| +++ lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialOperation.java (revision ) |
| @@ -38,7 +38,10 @@ |
| private static final List<SpatialOperation> list = new ArrayList<SpatialOperation>(); |
| |
| // Geometry Operations |
| + |
| + /** Bounding box of the *indexed* shape. */ |
| public static final SpatialOperation BBoxIntersects = new SpatialOperation("BBoxIntersects", true, false, false); |
| + /** Bounding box of the *indexed* shape. */ |
| public static final SpatialOperation BBoxWithin = new SpatialOperation("BBoxWithin", true, false, false); |
| public static final SpatialOperation Contains = new SpatialOperation("Contains", true, true, false); |
| public static final SpatialOperation Intersects = new SpatialOperation("Intersects", true, false, false); |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java (revision ) |
| @@ -51,10 +51,10 @@ |
| } |
| |
| @Test |
| - public void testCitiesWithinBBox() throws IOException { |
| + public void testCitiesIntersectsBBox() throws IOException { |
| getAddAndVerifyIndexedDocuments(DATA_WORLD_CITIES_POINTS); |
| |
| - executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_IsWithin_BBox); |
| + executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_Intersects_BBox); |
| } |
| |
| } |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java (revision ) |
| @@ -18,7 +18,6 @@ |
| */ |
| |
| import com.spatial4j.core.context.SpatialContext; |
| -import com.spatial4j.core.context.SpatialContext; |
| import com.spatial4j.core.shape.Shape; |
| import org.apache.lucene.document.Document; |
| import org.apache.lucene.document.Field; |
| @@ -55,7 +54,7 @@ |
| SpatialArgsParser spatialArgsParser = new SpatialArgsParser(); |
| // TODO... use a non polygon query |
| // SpatialArgs spatialArgs = spatialArgsParser.parse( |
| -// "IsWithin(POLYGON((-127.00390625 39.8125,-112.765625 39.98828125,-111.53515625 31.375,-125.94921875 30.14453125,-127.00390625 39.8125)))", |
| +// "Intersects(POLYGON((-127.00390625 39.8125,-112.765625 39.98828125,-111.53515625 31.375,-125.94921875 30.14453125,-127.00390625 39.8125)))", |
| // new SimpleSpatialContext()); |
| |
| // Query query = prefixGridStrategy.makeQuery(spatialArgs, fieldInfo); |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (revision ) |
| @@ -61,7 +61,7 @@ |
| //execute queries for each prefix grid scan level |
| for(int i = 0; i <= maxLength; i++) { |
| ((RecursivePrefixTreeStrategy)strategy).setPrefixGridScanLevel(i); |
| - executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_IsWithin_BBox); |
| + executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_Intersects_BBox); |
| } |
| } |
| |
| Index: lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>UTF-8 |
| =================================================================== |
| --- lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (revision 1383734) |
| +++ lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (revision ) |
| @@ -27,7 +27,6 @@ |
| import org.apache.lucene.document.Field; |
| import org.apache.lucene.document.StoredField; |
| import org.apache.lucene.document.StringField; |
| -import org.apache.lucene.index.IndexableField; |
| import org.apache.lucene.spatial.query.SpatialArgsParser; |
| import org.junit.Assert; |
| |
| @@ -52,7 +51,7 @@ |
| |
| public static final String QTEST_States_IsWithin_BBox = "states-IsWithin-BBox.txt"; |
| public static final String QTEST_States_Intersects_BBox = "states-Intersects-BBox.txt"; |
| - public static final String QTEST_Cities_IsWithin_BBox = "cities-IsWithin-BBox.txt"; |
| + public static final String QTEST_Cities_Intersects_BBox = "cities-Intersects-BBox.txt"; |
| public static final String QTEST_Simple_Queries_BBox = "simple-Queries-BBox.txt"; |
| |
| private Logger log = Logger.getLogger(getClass().getName()); |