Indexed shapes should be returned with search geometries that share the dateline on the opposite hemisphere.
For example:
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);
}
Migrated from LUCENE-8721 by Nick Knize (@nknize), updated Mar 13 2019
Attachments: LUCENE-8721.patch (versions: 2)
Indexed shapes should be returned with search geometries that share the dateline on the opposite hemisphere.
For example:
Migrated from LUCENE-8721 by Nick Knize (@nknize), updated Mar 13 2019
Attachments: LUCENE-8721.patch (versions: 2)