Class BaseGeoPointTestCase


  • public abstract class BaseGeoPointTestCase
    extends LuceneTestCase
    Abstract class to do basic tests for a geospatial impl (high level fields and queries) NOTE: This test focuses on geospatial (distance queries, polygon queries, etc) indexing and search, not any underlying storage format or encoding: it merely supplies two hooks for the encoding so that tests can be exact. The [stretch] goal is for this test to be so thorough in testing a new geo impl that if this test passes, then all Lucene/Solr tests should also pass. Ie, if there is some bug in a given geo impl that this test fails to catch then this test needs to be improved!
    • Constructor Detail

      • BaseGeoPointTestCase

        public BaseGeoPointTestCase()
    • Method Detail

      • nextLongitude

        protected double nextLongitude()
      • nextLatitude

        protected double nextLatitude()
      • nextCircle

        protected Circle nextCircle()
      • nextPolygon

        protected Polygon nextPolygon()
      • testIndexExtremeValues

        public void testIndexExtremeValues()
        Valid values that should not cause exception
      • testIndexOutOfRangeValues

        public void testIndexOutOfRangeValues()
        Invalid values
      • testIndexNaNValues

        public void testIndexNaNValues()
        NaN: illegal
      • testIndexInfValues

        public void testIndexInfValues()
        Inf: illegal
      • testBoxBasics

        public void testBoxBasics()
                           throws Exception
        Add a single point and search for it in a box
        Throws:
        Exception
      • testBoxNull

        public void testBoxNull()
        null field name not allowed
      • testBoxInvalidCoordinates

        public void testBoxInvalidCoordinates()
                                       throws Exception
        Throws:
        Exception
      • testDistanceBasics

        public void testDistanceBasics()
                                throws Exception
        test we can search for a point
        Throws:
        Exception
      • testDistanceNull

        public void testDistanceNull()
        null field name not allowed
      • testDistanceIllegal

        public void testDistanceIllegal()
                                 throws Exception
        distance query should not accept invalid lat/lon as origin
        Throws:
        Exception
      • testDistanceNegative

        public void testDistanceNegative()
        negative distance queries are not allowed
      • testDistanceNaN

        public void testDistanceNaN()
        NaN distance queries are not allowed
      • testDistanceInf

        public void testDistanceInf()
        Inf distance queries are not allowed
      • testPolygonBasics

        public void testPolygonBasics()
                               throws Exception
        test we can search for a polygon
        Throws:
        Exception
      • testPolygonHole

        public void testPolygonHole()
                             throws Exception
        test we can search for a polygon with a hole (but still includes the doc)
        Throws:
        Exception
      • testPolygonHoleExcludes

        public void testPolygonHoleExcludes()
                                     throws Exception
        test we can search for a polygon with a hole (that excludes the doc)
        Throws:
        Exception
      • testMultiPolygonBasics

        public void testMultiPolygonBasics()
                                    throws Exception
        test we can search for a multi-polygon
        Throws:
        Exception
      • testPolygonNullField

        public void testPolygonNullField()
        null field name not allowed
      • testSamePointManyTimes

        public void testSamePointManyTimes()
                                    throws Exception
        Throws:
        Exception
      • testLowCardinality

        public void testLowCardinality()
                                throws Exception
        Throws:
        Exception
      • quantizeLat

        protected double quantizeLat​(double lat)
        Override this to quantize randomly generated lat, so the test won't fail due to quantization errors, which are 1) annoying to debug, and 2) should never affect "real" usage terribly.
      • quantizeLon

        protected double quantizeLon​(double lon)
        Override this to quantize randomly generated lon, so the test won't fail due to quantization errors, which are 1) annoying to debug, and 2) should never affect "real" usage terribly.
      • addPointToDoc

        protected abstract void addPointToDoc​(String field,
                                              Document doc,
                                              double lat,
                                              double lon)
      • newRectQuery

        protected abstract Query newRectQuery​(String field,
                                              double minLat,
                                              double maxLat,
                                              double minLon,
                                              double maxLon)
      • newDistanceQuery

        protected abstract Query newDistanceQuery​(String field,
                                                  double centerLat,
                                                  double centerLon,
                                                  double radiusMeters)
      • newPolygonQuery

        protected abstract Query newPolygonQuery​(String field,
                                                 Polygon... polygon)
      • verifyRandomRectangles

        protected void verifyRandomRectangles​(double[] lats,
                                              double[] lons)
                                       throws Exception
        Throws:
        Exception
      • verifyRandomDistances

        protected void verifyRandomDistances​(double[] lats,
                                             double[] lons)
                                      throws Exception
        Throws:
        Exception
      • verifyRandomPolygons

        protected void verifyRandomPolygons​(double[] lats,
                                            double[] lons)
                                     throws Exception
        Throws:
        Exception
      • verifyRandomGeometries

        protected void verifyRandomGeometries​(double[] lats,
                                              double[] lons)
                                       throws Exception
        Throws:
        Exception
      • testRectBoundariesAreInclusive

        public void testRectBoundariesAreInclusive()
                                            throws Exception
        Throws:
        Exception
      • testRandomDistance

        public void testRandomDistance()
                                throws Exception
        Run a few iterations with just 10 docs, hopefully easy to debug
        Throws:
        Exception
      • testRandomDistanceHuge

        @Nightly
        public void testRandomDistanceHuge()
                                    throws Exception
        Runs with thousands of docs
        Throws:
        Exception
      • testSmallSetDateline

        public void testSmallSetDateline()
                                  throws Exception
        Throws:
        Exception
      • testSmallSetMultiValued

        public void testSmallSetMultiValued()
                                     throws Exception
        Throws:
        Exception
      • testSmallSetWholeMap

        public void testSmallSetWholeMap()
                                  throws Exception
        Throws:
        Exception
      • testSmallSetPolyWholeMap

        public void testSmallSetPolyWholeMap()
                                      throws Exception
        Throws:
        Exception
      • testSmallSetDistance

        public void testSmallSetDistance()
                                  throws Exception
        Throws:
        Exception
      • testSmallSetTinyDistance

        public void testSmallSetTinyDistance()
                                      throws Exception
        Throws:
        Exception
      • testSmallSetDistanceNotEmpty

        public void testSmallSetDistanceNotEmpty()
                                          throws Exception
        see https://issues.apache.org/jira/browse/LUCENE-6905
        Throws:
        Exception
      • testSmallSetHugeDistance

        public void testSmallSetHugeDistance()
                                      throws Exception
        Explicitly large
        Throws:
        Exception
      • testSmallSetDistanceDateline

        public void testSmallSetDistanceDateline()
                                          throws Exception
        Throws:
        Exception