You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Nicholas Knize (JIRA)" <ji...@apache.org> on 2019/03/11 20:04:00 UTC

[jira] [Created] (LUCENE-8721) LatLonShapePolygon and LineQuery fail on shared dateline queries

Nicholas Knize created LUCENE-8721:
--------------------------------------

             Summary: 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


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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org