org.apache.lucene.geo

## Class BaseGeoPointTestCase

- java.lang.Object
- - org.junit.Assert
  - - org.apache.lucene.util.LuceneTestCase
    - - org.apache.lucene.geo.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!

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.util.LuceneTestCase

      `LuceneTestCase.AwaitsFix, LuceneTestCase.BadApple, LuceneTestCase.Monster, LuceneTestCase.Nightly, LuceneTestCase.Slow, LuceneTestCase.SuppressCodecs, LuceneTestCase.SuppressFileSystems, LuceneTestCase.SuppressFsync, LuceneTestCase.SuppressReproduceLine, LuceneTestCase.SuppressSysoutChecks, LuceneTestCase.SuppressTempFileChecks, LuceneTestCase.ThrowingRunnable, LuceneTestCase.Weekly`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `FIELD_NAME`

    - ### Fields inherited from class org.apache.lucene.util.LuceneTestCase

      `assertsAreEnabled, classRules, DEFAULT_LINE_DOCS_FILE, INFOSTREAM, JENKINS_LARGE_LINE_DOCS_FILE, LEAVE_TEMPORARY, MAYBE_CACHE_POLICY, RANDOM_MULTIPLIER, ruleChain, suiteFailureMarker, SYSPROP_AWAITSFIX, SYSPROP_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_SLOW, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_BADAPPLES, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_SLOW, TEST_THROTTLING, TEST_WEEKLY, VERBOSE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseGeoPointTestCase()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `addPointToDoc(String field, Document doc, double lat, double lon)`
    `protected abstract Query` | `newDistanceQuery(String field, double centerLat, double centerLon, double radiusMeters)`
    `protected abstract Query` | `newPolygonQuery(String field, Polygon... polygon)`
    `protected abstract Query` | `newRectQuery(String field, double minLat, double maxLat, double minLon, double maxLon)`
    `protected Rectangle` | `nextBox()`
    `protected double` | `nextLatitude()`
    `protected double` | `nextLongitude()`
    `protected Polygon` | `nextPolygon()`
    `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.
    `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.
    `protected boolean` | `supportsPolygons()` Whether this impl supports polygons.
    `void` | `testAllLatEqual()`
    `void` | `testAllLonEqual()`
    `void` | `testBoxBasics()` Add a single point and search for it in a box
    `void` | `testBoxInvalidCoordinates()`
    `void` | `testBoxNull()` null field name not allowed
    `void` | `testDistanceBasics()` test we can search for a point
    `void` | `testDistanceIllegal()` distance query should not accept invalid lat/lon as origin
    `void` | `testDistanceInf()` Inf distance queries are not allowed
    `void` | `testDistanceNaN()` NaN distance queries are not allowed
    `void` | `testDistanceNegative()` negative distance queries are not allowed
    `void` | `testDistanceNull()` null field name not allowed
    `void` | `testEquals()`
    `void` | `testIndexExtremeValues()` Valid values that should not cause exception
    `void` | `testIndexInfValues()` Inf: illegal
    `void` | `testIndexNaNValues()` NaN: illegal
    `void` | `testIndexOutOfRangeValues()` Invalid values
    `void` | `testMultiPolygonBasics()` test we can search for a multi-polygon
    `void` | `testMultiValued()`
    `void` | `testPolygonBasics()` test we can search for a polygon
    `void` | `testPolygonHole()` test we can search for a polygon with a hole (but still includes the doc)
    `void` | `testPolygonHoleExcludes()` test we can search for a polygon with a hole (that excludes the doc)
    `void` | `testPolygonNullField()` null field name not allowed
    `void` | `testRandomBig()`
    `void` | `testRandomDistance()` Run a few iterations with just 10 docs, hopefully easy to debug
    `void` | `testRandomDistanceHuge()` Runs with thousands of docs
    `void` | `testRandomMedium()`
    `void` | `testRandomTiny()`
    `void` | `testRectBoundariesAreInclusive()`
    `void` | `testSamePointManyTimes()`
    `void` | `testSmallSetDateline()`
    `void` | `testSmallSetDistance()`
    `void` | `testSmallSetDistanceDateline()`
    `void` | `testSmallSetDistanceNotEmpty()` see https://issues.apache.org/jira/browse/LUCENE-6905
    `void` | `testSmallSetHugeDistance()` Explicitly large
    `void` | `testSmallSetMultiValued()`
    `void` | `testSmallSetPoly()`
    `void` | `testSmallSetPolyWholeMap()`
    `void` | `testSmallSetRect()`
    `void` | `testSmallSetTinyDistance()`
    `void` | `testSmallSetWholeMap()`
    `protected void` | `verifyRandomDistances(double[] lats, double[] lons)`
    `protected void` | `verifyRandomPolygons(double[] lats, double[] lons)`
    `protected void` | `verifyRandomRectangles(double[] lats, double[] lons)`

    - ### Methods inherited from class org.apache.lucene.util.LuceneTestCase

      `addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertFieldInfosEquals, assertFieldsEquals, assertFieldStatisticsEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, assumeWorkingMMapOnWindows, atLeast, atLeast, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getBaseTempDirForTestClass, getDataInputStream, getDataPath, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newDirectory, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newIndexWriterConfig, newIOContext, newIOContext, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newMaybeVirusCheckingDirectory, newMaybeVirusCheckingFSDirectory, newMergePolicy, newMergePolicy, newMergePolicy, newMockDirectory, newMockDirectory, newMockDirectory, newMockFSDirectory, newMockFSDirectory, newSearcher, newSearcher, newSearcher, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, restoreSpins, runWithRestrictedPermissions, setIndexWriterMaxDocs, setUp, setupCPUCoreCount, setupSpins, slowFileExists, tearDown, usually, usually, wrapReader`

    - ### Methods inherited from class org.junit.Assert

      `assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FIELD_NAME

          protected static final String FIELD_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BaseGeoPointTestCase

          public BaseGeoPointTestCase()

  - ### Method Detail

    - #### nextLongitude

          protected double nextLongitude()

    - #### nextLatitude

          protected double nextLatitude()

    - #### nextBox

          protected Rectangle nextBox()

    - #### nextPolygon

          protected Polygon nextPolygon()

    - #### supportsPolygons

          protected boolean supportsPolygons()

      Whether this impl supports polygons.

    - #### 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`

    - #### testAllLatEqual

          public void testAllLatEqual()
                               throws Exception

      Throws:
        `Exception`

    - #### testAllLonEqual

          public void testAllLonEqual()
                               throws Exception

      Throws:
        `Exception`

    - #### testMultiValued

          public void testMultiValued()
                               throws Exception

      Throws:
        `Exception`

    - #### testRandomTiny

          public void testRandomTiny()
                              throws Exception

      Throws:
        `Exception`

    - #### testRandomMedium

          public void testRandomMedium()
                                throws Exception

      Throws:
        `Exception`

    - #### testRandomBig

          @LuceneTestCase.Nightly
          public void testRandomBig()
                                                     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`

    - #### 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

          @LuceneTestCase.Nightly
          public void testRandomDistanceHuge()
                                                              throws Exception

      Runs with thousands of docs
      Throws:
        `Exception`

    - #### testEquals

          public void testEquals()
                          throws Exception

      Throws:
        `Exception`

    - #### testSmallSetRect

          public void testSmallSetRect()
                                throws Exception

      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`

    - #### testSmallSetPoly

          public void testSmallSetPoly()
                                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`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.