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

Ignacio Vera commented on LUCENE-8721:
--------------------------------------

In addition, it won't work for all cases for triangles as the coordinates are 
on the encoded space, so 180 becomes 179.99999991618097 so one side of the 
equality will never be true.

+1 to simplify the logic on EdgeTree. It is trivial to merge the methods 
{{relate}} &  {{internalComponentRelate}} and it makes sense. I will open an 
issue.

> LatLonShapePolygon and LineQuery fail on shared dateline queries
> ----------------------------------------------------------------
>
>                 Key: LUCENE-8721
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8721
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Nicholas Knize
>            Priority: Major
>         Attachments: LUCENE-8721.patch
>
>
> Indexed shapes should be returned with search geometries that share the 
> dateline on the opposite hemisphere. 
> For example:
> {code:java}
>   public void testSharedDateline() throws Exception {
>     //// index /////
>     Directory dir = newDirectory();
>     RandomIndexWriter w = new RandomIndexWriter(random(), dir);
>     Document doc = new Document();
>     // index western hemisphere geometry
>     Polygon indexPoly = new Polygon(
>         new double[] {-7.5d, 15d, 15d, 0d, -7.5d},
>         new double[] {-180d, -180d, -176d, -176d, -180d}
>     );
>     Field[] fields = LatLonShape.createIndexableFields("test", indexPoly);
>     for (Field f : fields) {
>       doc.add(f);
>     }
>     w.addDocument(doc);
>     w.forceMerge(1);
>     ///// search //////
>     IndexReader reader = w.getReader();
>     w.close();
>     IndexSearcher searcher = newSearcher(reader);
>     // search w/ eastern hemisphere geometry that shares the dateline
>     Polygon searchPoly = new Polygon(new double[] {-7.5d, 15d, 15d, 0d, 
> -7.5d},
>         new double[] {180d, 180d, 170d, 170d, 180d});
>     Query q = LatLonShape.newPolygonQuery("test", QueryRelation.INTERSECTS, 
> searchPoly);
>     assertEquals(1, searcher.count(q));
>     IOUtils.close(w, reader, dir);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to