Index: lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java (revision 1487019) +++ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java (revision ) @@ -58,6 +58,8 @@ public class SpatialOpRecursivePrefixTreeTest extends StrategyTestCase { + static final int ITERATIONS = 10;//Test Iterations + private SpatialPrefixTree grid; @Before @@ -81,28 +83,28 @@ } @Test - @Repeat(iterations = 10) + @Repeat(iterations = ITERATIONS) public void testIntersects() throws IOException { mySetup(-1); doTest(SpatialOperation.Intersects); } @Test - @Repeat(iterations = 10) + @Repeat(iterations = ITERATIONS) public void testWithin() throws IOException { mySetup(-1); doTest(SpatialOperation.IsWithin); } @Test - @Repeat(iterations = 10) + @Repeat(iterations = ITERATIONS) public void testContains() throws IOException { mySetup(-1); doTest(SpatialOperation.Contains); } @Test - @Repeat(iterations = 10) + @Repeat(iterations = ITERATIONS) public void testDisjoint() throws IOException { mySetup(-1); doTest(SpatialOperation.IsDisjointTo); @@ -334,9 +336,10 @@ @Override public SpatialRelation relate(Shape other) { SpatialRelation r = relateApprox(other); - if (r != INTERSECTS) + if (r != INTERSECTS && !(r == WITHIN && biasContainsThenWithin)) return r; - //See if the correct answer is actually Contains + //See if the correct answer is actually Contains, when the indexed shapes are adjacent, + // creating a larger shape that contains the input shape. Rectangle oRect = (Rectangle)other; boolean pairTouches = shape1.relate(shape2).intersects(); if (!pairTouches)