lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1379395 - /incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs
Date Fri, 31 Aug 2012 10:09:31 GMT
Author: synhershko
Date: Fri Aug 31 10:09:31 2012
New Revision: 1379395

URL: http://svn.apache.org/viewvc?rev=1379395&view=rev
Log:
Adding failing test

Modified:
    incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs

Modified: incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs?rev=1379395&r1=1379394&r2=1379395&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs
(original)
+++ incubator/lucene.net/trunk/test/contrib/Spatial/Prefix/TestRecursivePrefixTreeStrategy.cs
Fri Aug 31 10:09:31 2012
@@ -44,6 +44,26 @@ namespace Lucene.Net.Contrib.Spatial.Tes
 		}
 
 		[Test]
+		public void testPointAndRadius()
+		{
+			init(GeohashPrefixTree.GetMaxLevelsPossible());
+
+			addDocument(newDoc("spatials/1", ctx.MakePoint(2.8028712999999925, 48.3708044))); //lon,
lat
+			commit();
+
+			Point queryShape = ctx.MakePoint(2.4632387000000335, 48.6003516);
+			checkHits(queryShape, 35.75, 1, null);
+			checkHits(queryShape, 30, 0, null);
+			checkHits(queryShape, 33, 0, null);
+			checkHits(queryShape, 34, 0, null);
+
+            checkHits(queryShape, 35.75, 1, null, 0.025);
+            checkHits(queryShape, 30, 0, null, 0.025);
+            checkHits(queryShape, 33, 0, null, 0.025);
+            checkHits(queryShape, 34, 0, null, 0.025);
+		}
+
+		[Test]
 		public void testFilterWithVariableScanLevel()
 		{
 			init(GeohashPrefixTree.GetMaxLevelsPossible());
@@ -132,11 +152,11 @@ namespace Lucene.Net.Contrib.Spatial.Tes
 		}//randomTest()
 
 		//TODO can we use super.runTestQueries() ?
-		private void checkHits(Point pt, double dist, int assertNumFound, int[] assertIds)
+		private void checkHits(Point pt, double dist, int assertNumFound, int[] assertIds, double
distPrecison = 0.0)
 		{
 			Shape shape = ctx.MakeCircle(pt, dist);
 			SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, shape);
-			args.SetDistPrecision(0.0);
+            args.SetDistPrecision(distPrecison);
 			SearchResults got = executeQuery(strategy.MakeQuery(args), 100);
 			Assert.AreEqual(assertNumFound, got.numFound, "" + shape);
 			if (assertIds != null)



Mime
View raw message