Search in sources :

Example 16 with GeoEntry

use of org.codice.ddf.spatial.geocoding.GeoEntry in project ddf by codice.

the class TestGeoNamesQueryLuceneIndex method testQueryWithNoResults.

@Test
public void testQueryWithNoResults() throws IOException, ParseException, GeoEntryQueryException {
    final int requestedMaxResults = 2;
    final int actualResults = 0;
    final String queryString = "another place";
    final List<GeoEntry> results = directoryIndex.query(queryString, requestedMaxResults);
    assertThat(results.size(), is(actualResults));
}
Also used : GeoEntry(org.codice.ddf.spatial.geocoding.GeoEntry) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 17 with GeoEntry

use of org.codice.ddf.spatial.geocoding.GeoEntry in project ddf by codice.

the class TestGeoNamesQueryLuceneIndex method testQueryWithLessThanMaxResults.

@Test
public void testQueryWithLessThanMaxResults() throws IOException, ParseException, GeoEntryQueryException {
    final int requestedMaxResults = 2;
    final int actualResults = 1;
    final String queryString = "glendale";
    final List<GeoEntry> results = directoryIndex.query(queryString, requestedMaxResults);
    assertThat(results.size(), is(actualResults));
    final GeoEntry firstResult = results.get(0);
    // We don't store the alternate names, so we don't get them back with the query results.
    verifyGeoEntry(firstResult, NAME_3, LAT_3, LON_3, FEATURE_CODE_3, POP_3, null, COUNTRY_CODE3);
}
Also used : GeoEntry(org.codice.ddf.spatial.geocoding.GeoEntry) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

GeoEntry (org.codice.ddf.spatial.geocoding.GeoEntry)17 Test (org.junit.Test)12 Matchers.anyString (org.mockito.Matchers.anyString)4 GeoEntryExtractionException (org.codice.ddf.spatial.geocoding.GeoEntryExtractionException)3 ExtractionCallback (org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback)3 GeoEntryIndexingException (org.codice.ddf.spatial.geocoding.GeoEntryIndexingException)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 SpatialStrategy (org.apache.lucene.spatial.SpatialStrategy)2 RecursivePrefixTreeStrategy (org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy)2 GeohashPrefixTree (org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree)2 SpatialPrefixTree (org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree)2 GeoResult (org.codice.ddf.spatial.geocoder.GeoResult)2 GeoEntryExtractor (org.codice.ddf.spatial.geocoding.GeoEntryExtractor)2 GeoEntryQueryException (org.codice.ddf.spatial.geocoding.GeoEntryQueryException)2 ProgressCallback (org.codice.ddf.spatial.geocoding.ProgressCallback)2 List (java.util.List)1 Document (org.apache.lucene.document.Document)1 IndexReader (org.apache.lucene.index.IndexReader)1 IndexWriter (org.apache.lucene.index.IndexWriter)1