lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-8669) LatLonShape WITHIN queries fail with Multiple search Polygons that share the dateline
Date Thu, 31 Jan 2019 22:47:00 GMT

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

ASF subversion and git services commented on LUCENE-8669:
---------------------------------------------------------

Commit fd92d54b38a7a7048e84ff20b2d26e6c05e116e7 in lucene-solr's branch refs/heads/branch_8_0
from Nicholas Knize
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=fd92d54 ]

LUCENE-8669: Fix LatLonShape WITHIN queries that fail with Multiple search Polygons that share
the dateline.


> LatLonShape WITHIN queries fail with Multiple search Polygons that share the dateline
> -------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8669
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8669
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 8.0, 7.7
>            Reporter: Nicholas Knize
>            Assignee: Nicholas Knize
>            Priority: Blocker
>         Attachments: LUCENE-8669.patch
>
>
> {{LatLonShape.newPolygonQuery}} does not support dateline crossing polygons. It is therefore
up to the calling application / user to split dateline crossing polygons into a {{MultiPolygon}}
query with two search polygons that share the dateline. This, however, does not produce expected
results because {{EdgeTree.internalComponentRelateTriangle}} does not differentiate between
a triangle that {{CROSSES}} or is {{WITHIN}} the target polygon. Therefore {{MultiPolygon}}
{{WITHIN}} queries that share the dateline behave as an {{INTERSECT}} and will therefore produce
incorrect results.
> Consider the following test, for example:
> {code:java}
>     // index
>     // western poly
>     Polygon indexPoly1 = new Polygon(
>         new double[] {-7.5d, 15d, 15d, 0d, -7.5d},
>         new double[] {-180d, -180d, -176d, -176d, -180d}
>     );
>     // eastern poly
>     Polygon indexPoly2 = new Polygon(
>         new double[] {15d, -7.5d, -15d, -10d, 15d, 15d},
>         new double[] {180d, 180d, 176d, 174d, 176d, 180d}
>     );
>     //// index ////
>     Field[] fields = LatLonShape.createIndexableFields("test", indexPoly1);
>     for (Field f : fields) {
>       doc.add(f);
>     }
>     fields = LatLonShape.createIndexableFields("test", indexPoly2);
>     for (Field f : fields) {
>       doc.add(f);
>     }
>     writer.addDocument(doc);
>     ///// search //////
>     Polygon[] searchPoly = new Polygon[] {
>         new Polygon(new double[] {-20d, 20d, 20d, -20d, -20d},
>             new double[] {-180d, -180d, -170d, -170d, -180d}),
>         new Polygon(new double[] {20d, -20d, -20d, 20d, 20d},
>             new double[] {180d, 180d, 170d, 170d, 180d})
>     };
>     Query q = LatLonShape.newPolygonQuery("test", QueryRelation.WITHIN, searchPoly);
>     assertEquals(1, searcher.count(q));
> {code}
>  
> In the example above, a dateline spanning polygon is indexed as a {{MultiPolygon}} with
two polygons that share the dateline. Similarly, a polygon that spans the dateline is provided
as  two polygons that share the dateline in a {{WITHIN}} query. The indexed polygon should
be returned as a match; but it does not.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message