lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Itamar Syn-Hershko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENENET-483) Spatial Search skipping records when one location is close to origin, another one is away and radius is wider
Date Mon, 21 May 2012 22:21:41 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280552#comment-13280552
] 

Itamar Syn-Hershko commented on LUCENENET-483:
----------------------------------------------

Great.

I updated the Lucene.Net.Contrib.Spatial.dll to be of version 2.9.9 to avoid future confusion.
This is a unique version number suggesting this is a non-standard issued contrib - Java Lucene
will only have this module in version 4.0.
                
> Spatial Search skipping records when one location is close to origin, another one is
away and radius is wider
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-483
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-483
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Contrib
>    Affects Versions: Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>         Environment: .Net framework 4.0
>            Reporter: Aleksandar Panov
>              Labels: lucene, spatialsearch
>             Fix For: Lucene.Net 3.0.3
>
>
> Running a spatial query against two locations where one location is close to origin (less
than a mile), another one is away (24 miles) and radius is wider (52 miles) returns only one
result. Running query with a bit wider radius (53.8) returns 2 results.
> IMPORTANT UPDATE: Problem can't be reproduced in Java, with using original Lucene.Spatial
(2.9.4 version) library.
> {code}
>         // Origin
>         private double _lat = 42.350153;
>         private double _lng = -71.061667;
>         private const string LatField = "lat";
>         private const string LngField = "lng";
>         //Locations            
>         AddPoint(writer, "Location 1", 42.0, -71.0); //24 miles away from origin
>         AddPoint(writer, "Location 2", 42.35, -71.06); //less than a mile
>         [TestMethod]
>         public void TestAntiM()
>         {
>             _directory = new RAMDirectory();
>             var writer = new IndexWriter(_directory, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.UNLIMITED);
>             SetUpPlotter(2, 15);
>             AddData(writer);
>             _searcher = new IndexSearcher(_directory, true);
>             //const double miles = 53.8; // Correct. Returns 2 Locations.
>             const double miles = 52; // Incorrect. Returns 1 Location.
>             Console.WriteLine("testAntiM");
>             // create a distance query
>             var dq = new DistanceQueryBuilder(_lat, _lng, miles, LatField, LngField,
CartesianTierPlotter.DefaltFieldPrefix, true);
>             Console.WriteLine(dq);
>             //create a term query to search against all documents
>             Query tq = new TermQuery(new Term("metafile", "doc"));
>             var dsort = new DistanceFieldComparatorSource(dq.DistanceFilter);
>             Sort sort = new Sort(new SortField("foo", dsort, false));
>             // Perform the search, using the term query, the distance filter, and the
>             // distance sort
>             TopDocs hits = _searcher.Search(tq, dq.Filter, 1000, sort);
>             int results = hits.TotalHits;
>             ScoreDoc[] scoreDocs = hits.ScoreDocs;
>             // Get a list of distances
>             Dictionary<int, Double> distances = dq.DistanceFilter.Distances;
>             Console.WriteLine("Distance Filter filtered: " + distances.Count);
>             Console.WriteLine("Results: " + results);
>             Console.WriteLine("=============================");
>             Console.WriteLine("Distances should be 2 " + distances.Count);
>             Console.WriteLine("Results should be 2 " + results);
>             Assert.AreEqual(2, distances.Count); // fixed a store of only needed distances
>             Assert.AreEqual(2, results);
>         }
> {code} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message