Package org.apache.lucene.tests.geo
Class BaseGeoPointTestCase
java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.apache.lucene.tests.geo.BaseGeoPointTestCase
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 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.tests.util.LuceneTestCase
LuceneTestCase.AwaitsFix, LuceneTestCase.Concurrency, LuceneTestCase.Monster, LuceneTestCase.Nightly, LuceneTestCase.SuppressCodecs, LuceneTestCase.SuppressFileSystems, LuceneTestCase.SuppressFsync, LuceneTestCase.SuppressReproduceLine, LuceneTestCase.SuppressSysoutChecks, LuceneTestCase.SuppressTempFileChecks, LuceneTestCase.ThrowingConsumer<T>, LuceneTestCase.ThrowingRunnable, LuceneTestCase.Weekly -
Field Summary
FieldsFields inherited from class org.apache.lucene.tests.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_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_THROTTLING, TEST_WEEKLY, VERBOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddPointToDoc(String field, Document doc, double lat, double lon) protected abstract QuerynewDistanceQuery(String field, double centerLat, double centerLon, double radiusMeters) protected abstract QuerynewGeometryQuery(String field, LatLonGeometry... geometry) protected abstract QuerynewPolygonQuery(String field, Polygon... polygon) protected abstract QuerynewRectQuery(String field, double minLat, double maxLat, double minLon, double maxLon) protected RectanglenextBox()protected Circleprotected LatLonGeometry[]protected doubleprotected doubleprotected Polygonprotected doublequantizeLat(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 doublequantizeLon(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.voidvoidvoidAdd a single point and search for it in a boxvoidvoidnull field name not allowedvoidtest we can search for a pointvoiddistance query should not accept invalid lat/lon as originvoidInf distance queries are not allowedvoidNaN distance queries are not allowedvoidnegative distance queries are not allowedvoidnull field name not allowedvoidvoidValid values that should not cause exceptionvoidInf: illegalvoidNaN: illegalvoidInvalid valuesvoidvoidtest we can search for a multi-polygonvoidvoidvoidtest we can search for a polygonvoidtest we can search for a polygon with a hole (but still includes the doc)voidtest we can search for a polygon with a hole (that excludes the doc)voidnull field name not allowedvoidvoidRun a few iterations with just 10 docs, hopefully easy to debugvoidRuns with thousands of docsvoidvoidvoidvoidvoidvoidvoidvoidsee https://issues.apache.org/jira/browse/LUCENE-6905voidExplicitly largevoidvoidvoidvoidvoidvoidprotected voidverifyRandomDistances(double[] lats, double[] lons) protected voidverifyRandomGeometries(double[] lats, double[] lons) protected voidverifyRandomPolygons(double[] lats, double[] lons) protected voidverifyRandomRectangles(double[] lats, double[] lons) Methods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertDoubleUlpEquals, assertFieldInfosEquals, assertFloatUlpEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, atLeast, atLeast, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getDataPath, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, 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, newSearcher, newSearcher, newSnapshotIndexWriterConfig, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, randomVectorFormat, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setUp, setupCPUCoreCount, setUpExecutorService, shutdownExecutorService, slowFileExists, tearDown, usually, usually, wrapReaderMethods 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, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
Field Details
-
FIELD_NAME
- See Also:
-
-
Constructor Details
-
BaseGeoPointTestCase
public BaseGeoPointTestCase()
-
-
Method Details
-
nextLongitude
protected double nextLongitude() -
nextLatitude
protected double nextLatitude() -
nextBox
-
nextCircle
-
nextPolygon
-
nextGeometry
-
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
Add a single point and search for it in a box- Throws:
Exception
-
testBoxNull
public void testBoxNull()null field name not allowed -
testBoxInvalidCoordinates
- Throws:
Exception
-
testDistanceBasics
test we can search for a point- Throws:
Exception
-
testDistanceNull
public void testDistanceNull()null field name not allowed -
testDistanceIllegal
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
test we can search for a polygon- Throws:
Exception
-
testPolygonHole
test we can search for a polygon with a hole (but still includes the doc)- Throws:
Exception
-
testPolygonHoleExcludes
test we can search for a polygon with a hole (that excludes the doc)- Throws:
Exception
-
testMultiPolygonBasics
test we can search for a multi-polygon- Throws:
Exception
-
testPolygonNullField
public void testPolygonNullField()null field name not allowed -
testSamePointManyTimes
- Throws:
Exception
-
testLowCardinality
- Throws:
Exception
-
testAllLatEqual
- Throws:
Exception
-
testAllLonEqual
- Throws:
Exception
-
testMultiValued
- Throws:
Exception
-
testRandomTiny
- Throws:
Exception
-
testRandomMedium
- Throws:
Exception
-
testRandomBig
- 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
-
newRectQuery
-
newDistanceQuery
-
newPolygonQuery
-
newGeometryQuery
-
verifyRandomRectangles
- Throws:
Exception
-
verifyRandomDistances
- Throws:
Exception
-
verifyRandomPolygons
- Throws:
Exception
-
verifyRandomGeometries
- Throws:
Exception
-
testRectBoundariesAreInclusive
- Throws:
Exception
-
testRandomDistance
Run a few iterations with just 10 docs, hopefully easy to debug- Throws:
Exception
-
testRandomDistanceHuge
Runs with thousands of docs- Throws:
Exception
-
testEquals
- Throws:
Exception
-
testSmallSetRect
- Throws:
Exception
-
testSmallSetDateline
- Throws:
Exception
-
testSmallSetMultiValued
- Throws:
Exception
-
testSmallSetWholeMap
- Throws:
Exception
-
testSmallSetPoly
- Throws:
Exception
-
testSmallSetPolyWholeMap
- Throws:
Exception
-
testSmallSetDistance
- Throws:
Exception
-
testSmallSetTinyDistance
- Throws:
Exception
-
testSmallSetDistanceNotEmpty
see https://issues.apache.org/jira/browse/LUCENE-6905- Throws:
Exception
-
testSmallSetHugeDistance
Explicitly large- Throws:
Exception
-
testSmallSetDistanceDateline
- Throws:
Exception
-
testNarrowPolygonCloseToNorthPole
- Throws:
Exception
-