diff --git a/src/main/java/de/komoot/photon/PhotonDoc.java b/src/main/java/de/komoot/photon/PhotonDoc.java index e5f0dd9a7..5d0d8fcd8 100644 --- a/src/main/java/de/komoot/photon/PhotonDoc.java +++ b/src/main/java/de/komoot/photon/PhotonDoc.java @@ -18,21 +18,21 @@ @Getter @Slf4j public class PhotonDoc { - final private long placeId; - final private String osmType; - final private long osmId; - final private String tagKey; - final private String tagValue; - final private Map name; + private final long placeId; + private final String osmType; + private final long osmId; + private final String tagKey; + private final String tagValue; + private final Map name; private String postcode; - final private Map address; - final private Map extratags; - final private Envelope bbox; - final private long parentPlaceId; // 0 if unset - final private double importance; - final private CountryCode countryCode; - final private long linkedPlaceId; // 0 if unset - final private int rankAddress; + private final Map address; + private final Map extratags; + private final Envelope bbox; + private final long parentPlaceId; // 0 if unset + private final double importance; + private final CountryCode countryCode; + private final long linkedPlaceId; // 0 if unset + private final int rankAddress; private Map> addressParts = new EnumMap<>(AddressType.class); private Set> context = new HashSet<>(); diff --git a/src/main/java/de/komoot/photon/elasticsearch/Importer.java b/src/main/java/de/komoot/photon/elasticsearch/Importer.java index d4c33bef5..4ebdc70f2 100644 --- a/src/main/java/de/komoot/photon/elasticsearch/Importer.java +++ b/src/main/java/de/komoot/photon/elasticsearch/Importer.java @@ -6,8 +6,6 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.client.Requests; -import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; @@ -20,8 +18,6 @@ public class Importer implements de.komoot.photon.Importer { private int documentCount = 0; - private final String indexName = "photon"; - private final String indexType = "place"; private final Client esClient; private BulkRequestBuilder bulkRequest; private final String[] languages; @@ -35,7 +31,7 @@ public Importer(Client esClient, String languages) { @Override public void add(PhotonDoc doc) { try { - this.bulkRequest.add(this.esClient.prepareIndex(indexName, indexType). + this.bulkRequest.add(this.esClient.prepareIndex(PhotonIndex.NAME, PhotonIndex.TYPE). setSource(Utils.convert(doc, languages)).setId(doc.getUid())); } catch (IOException e) { log.error("could not bulk add document " + doc.getUid(), e); @@ -62,9 +58,4 @@ public void finish() { this.saveDocuments(); this.documentCount = 0; } - - public long count() { - return this.esClient.search(Requests.searchRequest(indexName).types(indexType).source(SearchSourceBuilder.searchSource().size(0))).actionGet().getHits() - .getTotalHits(); - } } diff --git a/src/main/java/de/komoot/photon/elasticsearch/PhotonIndex.java b/src/main/java/de/komoot/photon/elasticsearch/PhotonIndex.java new file mode 100644 index 000000000..c20014041 --- /dev/null +++ b/src/main/java/de/komoot/photon/elasticsearch/PhotonIndex.java @@ -0,0 +1,11 @@ +package de.komoot.photon.elasticsearch; + +/** + * Constants describing the index used for the photon database. + */ +public class PhotonIndex { + private PhotonIndex() {} + + public static final String NAME = "photon"; + public static final String TYPE = "place"; +} diff --git a/src/main/java/de/komoot/photon/elasticsearch/Server.java b/src/main/java/de/komoot/photon/elasticsearch/Server.java index 858214e8f..cc015a55e 100644 --- a/src/main/java/de/komoot/photon/elasticsearch/Server.java +++ b/src/main/java/de/komoot/photon/elasticsearch/Server.java @@ -183,29 +183,29 @@ public void recreateIndex() throws IOException { final Client client = this.getClient(); final InputStream mappings = Thread.currentThread().getContextClassLoader() .getResourceAsStream("mappings.json"); - final InputStream index_settings = Thread.currentThread().getContextClassLoader() + final InputStream indexSettings = Thread.currentThread().getContextClassLoader() .getResourceAsStream("index_settings.json"); - final Charset utf8_charset = Charset.forName("utf-8"); + final Charset utf8Charset = Charset.forName("utf-8"); - String mappingsString = IOUtils.toString(mappings, utf8_charset); + String mappingsString = IOUtils.toString(mappings, utf8Charset); JSONObject mappingsJSON = new JSONObject(mappingsString); // add all langs to the mapping mappingsJSON = addLangsToMapping(mappingsJSON); - JSONObject settings = new JSONObject(IOUtils.toString(index_settings, utf8_charset)); + JSONObject settings = new JSONObject(IOUtils.toString(indexSettings, utf8Charset)); if (shards != null) { settings.put("index", new JSONObject("{ \"number_of_shards\":" + shards + " }")); } - client.admin().indices().prepareCreate("photon").setSettings(settings.toString(), XContentType.JSON).execute().actionGet(); - ; - client.admin().indices().preparePutMapping("photon").setType("place").setSource(mappingsJSON.toString(), XContentType.JSON).execute().actionGet(); + client.admin().indices().prepareCreate(PhotonIndex.NAME).setSettings(settings.toString(), XContentType.JSON).execute().actionGet(); + + client.admin().indices().preparePutMapping(PhotonIndex.NAME).setType(PhotonIndex.TYPE).setSource(mappingsJSON.toString(), XContentType.JSON).execute().actionGet(); log.info("mapping created: " + mappingsJSON.toString()); } public void deleteIndex() { try { - this.getClient().admin().indices().prepareDelete("photon").execute().actionGet(); + this.getClient().admin().indices().prepareDelete(PhotonIndex.NAME).execute().actionGet(); } catch (IndexNotFoundException e) { // ignore } diff --git a/src/main/java/de/komoot/photon/elasticsearch/Updater.java b/src/main/java/de/komoot/photon/elasticsearch/Updater.java index c65665e0b..3bfd779e2 100644 --- a/src/main/java/de/komoot/photon/elasticsearch/Updater.java +++ b/src/main/java/de/komoot/photon/elasticsearch/Updater.java @@ -32,7 +32,7 @@ public void finish() { @Override public void updateOrCreate(PhotonDoc updatedDoc) { - final boolean exists = this.esClient.get(this.esClient.prepareGet("photon", "place", String.valueOf(updatedDoc.getPlaceId())).request()).actionGet().isExists(); + final boolean exists = this.esClient.get(this.esClient.prepareGet(PhotonIndex.NAME, PhotonIndex.TYPE, String.valueOf(updatedDoc.getPlaceId())).request()).actionGet().isExists(); if (exists) { this.update(updatedDoc); } else { @@ -42,7 +42,7 @@ public void updateOrCreate(PhotonDoc updatedDoc) { public void create(PhotonDoc doc) { try { - this.bulkRequest.add(this.esClient.prepareIndex("photon", "place").setSource(Utils.convert(doc, this.languages)).setId(String.valueOf(doc.getPlaceId()))); + this.bulkRequest.add(this.esClient.prepareIndex(PhotonIndex.NAME, PhotonIndex.TYPE).setSource(Utils.convert(doc, this.languages)).setId(String.valueOf(doc.getPlaceId()))); } catch (IOException e) { log.error(String.format("creation of new doc [%s] failed", doc), e); } @@ -50,14 +50,14 @@ public void create(PhotonDoc doc) { public void update(PhotonDoc doc) { try { - this.bulkRequest.add(this.esClient.prepareUpdate("photon", "place", String.valueOf(doc.getPlaceId())).setDoc(Utils.convert(doc, this.languages))); + this.bulkRequest.add(this.esClient.prepareUpdate(PhotonIndex.NAME, PhotonIndex.TYPE, String.valueOf(doc.getPlaceId())).setDoc(Utils.convert(doc, this.languages))); } catch (IOException e) { log.error(String.format("update of new doc [%s] failed", doc), e); } } public void delete(Long id) { - this.bulkRequest.add(this.esClient.prepareDelete("photon", "place", String.valueOf(id))); + this.bulkRequest.add(this.esClient.prepareDelete(PhotonIndex.NAME, PhotonIndex.TYPE, String.valueOf(id))); } private void updateDocuments() { diff --git a/src/main/java/de/komoot/photon/nominatim/NominatimUpdater.java b/src/main/java/de/komoot/photon/nominatim/NominatimUpdater.java index bbcf54263..36504c8a0 100644 --- a/src/main/java/de/komoot/photon/nominatim/NominatimUpdater.java +++ b/src/main/java/de/komoot/photon/nominatim/NominatimUpdater.java @@ -4,7 +4,6 @@ import de.komoot.photon.Updater; import de.komoot.photon.nominatim.model.UpdateRow; import org.apache.commons.dbcp2.BasicDataSource; -import org.postgis.jts.JtsWrapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; diff --git a/src/main/java/de/komoot/photon/nominatim/PostgisDataAdapter.java b/src/main/java/de/komoot/photon/nominatim/PostgisDataAdapter.java index ea1526884..be05bcc3a 100644 --- a/src/main/java/de/komoot/photon/nominatim/PostgisDataAdapter.java +++ b/src/main/java/de/komoot/photon/nominatim/PostgisDataAdapter.java @@ -31,7 +31,6 @@ public Map getMap(ResultSet rs, String columnName) throws SQLExc public Geometry extractGeometry(ResultSet rs, String columnName) throws SQLException { JtsGeometry geom = (JtsGeometry) rs.getObject(columnName); if (geom == null) { - //info("no geometry found in column " + columnName); return null; } return geom.getGeometry(); diff --git a/src/main/java/de/komoot/photon/query/LocationParamConverter.java b/src/main/java/de/komoot/photon/query/LocationParamConverter.java index 234249046..de5cdef44 100644 --- a/src/main/java/de/komoot/photon/query/LocationParamConverter.java +++ b/src/main/java/de/komoot/photon/query/LocationParamConverter.java @@ -12,7 +12,7 @@ * Created by Holger Bruch on 10/13/2018. */ public class LocationParamConverter { - private final static GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326); + private static final GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326); private boolean mandatory; public LocationParamConverter(boolean mandatory) { diff --git a/src/main/java/de/komoot/photon/query/PhotonQueryBuilder.java b/src/main/java/de/komoot/photon/query/PhotonQueryBuilder.java index 71d557ae2..ff222054e 100644 --- a/src/main/java/de/komoot/photon/query/PhotonQueryBuilder.java +++ b/src/main/java/de/komoot/photon/query/PhotonQueryBuilder.java @@ -34,9 +34,9 @@ * Created by Sachin Dole on 2/12/2015. */ public class PhotonQueryBuilder { - private FunctionScoreQueryBuilder m_finalQueryWithoutTagFilterBuilder; + private FunctionScoreQueryBuilder finalQueryWithoutTagFilterBuilder; - private BoolQueryBuilder m_queryBuilderForTopLevelFilter; + private BoolQueryBuilder queryBuilderForTopLevelFilter; private State state; @@ -50,11 +50,11 @@ public class PhotonQueryBuilder { private GeoBoundingBoxQueryBuilder bboxQueryBuilder; - private BoolQueryBuilder m_finalQueryBuilder; + private BoolQueryBuilder finalQueryBuilder; - protected ArrayList m_alFilterFunction4QueryBuilder = new ArrayList<>(1); + protected ArrayList alFilterFunction4QueryBuilder = new ArrayList<>(1); - protected QueryBuilder m_query4QueryBuilder; + protected QueryBuilder query4QueryBuilder; private PhotonQueryBuilder(String query, String language) { @@ -65,7 +65,7 @@ private PhotonQueryBuilder(String query, String language) { .analyzer("search_ngram").minimumShouldMatch("100%"); // @formatter:off - m_query4QueryBuilder = QueryBuilders.boolQuery() + query4QueryBuilder = QueryBuilders.boolQuery() .must(QueryBuilders.boolQuery().should(defaultMatchQueryBuilder).should(languageMatchQueryBuilder) .minimumShouldMatch("1")) .should(QueryBuilders.matchQuery(String.format("name.%s.raw", language), query).boost(200) @@ -79,13 +79,13 @@ private PhotonQueryBuilder(String query, String language) { ScriptScoreFunctionBuilder functionBuilder4QueryBuilder = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "painless", strCode, new HashMap())); - m_alFilterFunction4QueryBuilder.add(new FilterFunctionBuilder(functionBuilder4QueryBuilder)); + alFilterFunction4QueryBuilder.add(new FilterFunctionBuilder(functionBuilder4QueryBuilder)); - m_finalQueryWithoutTagFilterBuilder = new FunctionScoreQueryBuilder(m_query4QueryBuilder, m_alFilterFunction4QueryBuilder.toArray(new FilterFunctionBuilder[0])) + finalQueryWithoutTagFilterBuilder = new FunctionScoreQueryBuilder(query4QueryBuilder, alFilterFunction4QueryBuilder.toArray(new FilterFunctionBuilder[0])) .boostMode(CombineFunction.MULTIPLY).scoreMode(ScoreMode.MULTIPLY); // @formatter:off - m_queryBuilderForTopLevelFilter = QueryBuilders.boolQuery() + queryBuilderForTopLevelFilter = QueryBuilders.boolQuery() .should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("housenumber"))) .should(QueryBuilders.matchQuery("housenumber", query).analyzer("standard")) .should(QueryBuilders.existsQuery(String.format("name.%s.raw", language))); @@ -117,9 +117,9 @@ public PhotonQueryBuilder withLocationBias(Point point, double scale) { "double score = 0.1 + " + scale + " / (1.0 + dist * 0.001 / 10.0); " + "score"; ScriptScoreFunctionBuilder builder = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "painless", strCode, params)); - m_alFilterFunction4QueryBuilder.add(new FilterFunctionBuilder(builder)); - m_finalQueryWithoutTagFilterBuilder = - new FunctionScoreQueryBuilder(m_query4QueryBuilder, m_alFilterFunction4QueryBuilder.toArray(new FilterFunctionBuilder[0])) + alFilterFunction4QueryBuilder.add(new FilterFunctionBuilder(builder)); + finalQueryWithoutTagFilterBuilder = + new FunctionScoreQueryBuilder(query4QueryBuilder, alFilterFunction4QueryBuilder.toArray(new FilterFunctionBuilder[0])) .boostMode(CombineFunction.MULTIPLY); return this; } @@ -286,9 +286,9 @@ public PhotonQueryBuilder withLenientMatch() { * have no effect. */ public QueryBuilder buildQuery() { - if (state.equals(State.FINISHED)) return m_finalQueryBuilder; + if (state.equals(State.FINISHED)) return finalQueryBuilder; - m_finalQueryBuilder = QueryBuilders.boolQuery().must(m_finalQueryWithoutTagFilterBuilder).filter(m_queryBuilderForTopLevelFilter); + finalQueryBuilder = QueryBuilders.boolQuery().must(finalQueryWithoutTagFilterBuilder).filter(queryBuilderForTopLevelFilter); if (state.equals(State.FILTERED)) { BoolQueryBuilder tagFilters = QueryBuilders.boolQuery(); @@ -296,15 +296,15 @@ public QueryBuilder buildQuery() { tagFilters.must(orQueryBuilderForIncludeTagFiltering); if (andQueryBuilderForExcludeTagFiltering != null) tagFilters.must(andQueryBuilderForExcludeTagFiltering); - m_finalQueryBuilder.filter(tagFilters); + finalQueryBuilder.filter(tagFilters); } if (bboxQueryBuilder != null) - m_queryBuilderForTopLevelFilter.filter(bboxQueryBuilder); + queryBuilderForTopLevelFilter.filter(bboxQueryBuilder); state = State.FINISHED; - return m_finalQueryBuilder; + return finalQueryBuilder; } diff --git a/src/main/java/de/komoot/photon/query/PhotonRequestFactory.java b/src/main/java/de/komoot/photon/query/PhotonRequestFactory.java index 36756b997..a87206b9b 100644 --- a/src/main/java/de/komoot/photon/query/PhotonRequestFactory.java +++ b/src/main/java/de/komoot/photon/query/PhotonRequestFactory.java @@ -15,10 +15,10 @@ */ public class PhotonRequestFactory { private final RequestLanguageResolver languageResolver; - private final static LocationParamConverter optionalLocationParamConverter = new LocationParamConverter(false); + private static final LocationParamConverter optionalLocationParamConverter = new LocationParamConverter(false); private final BoundingBoxParamConverter bboxParamConverter; - protected static HashSet m_hsRequestQueryParams = new HashSet<>(Arrays.asList("lang", "q", "lon", "lat", + private static final HashSet REQUEST_QUERY_PARAMS = new HashSet<>(Arrays.asList("lang", "q", "lon", "lat", "limit", "osm_tag", "location_bias_scale", "bbox", "debug")); public PhotonRequestFactory(List supportedLanguages, String defaultLanguage) { @@ -30,8 +30,8 @@ public PhotonRequest create(Request webRequest) throws BadRequestException { for (String queryParam : webRequest.queryParams()) - if (!m_hsRequestQueryParams.contains(queryParam)) - throw new BadRequestException(400, "unknown query parameter '" + queryParam + "'. Allowed parameters are: " + m_hsRequestQueryParams); + if (!REQUEST_QUERY_PARAMS.contains(queryParam)) + throw new BadRequestException(400, "unknown query parameter '" + queryParam + "'. Allowed parameters are: " + REQUEST_QUERY_PARAMS); String language = languageResolver.resolveRequestedLanguage(webRequest); diff --git a/src/main/java/de/komoot/photon/query/ReverseRequestFactory.java b/src/main/java/de/komoot/photon/query/ReverseRequestFactory.java index 2ff1d03e4..01870246c 100644 --- a/src/main/java/de/komoot/photon/query/ReverseRequestFactory.java +++ b/src/main/java/de/komoot/photon/query/ReverseRequestFactory.java @@ -12,18 +12,18 @@ */ public class ReverseRequestFactory { private final RequestLanguageResolver languageResolver; - private final static LocationParamConverter mandatoryLocationParamConverter = new LocationParamConverter(true); + private static final LocationParamConverter mandatoryLocationParamConverter = new LocationParamConverter(true); - protected static HashSet m_hsRequestQueryParams = new HashSet<>(Arrays.asList("lang", "lon", "lat", "radius", "query_string_filter", "distance_sort", "limit")); + private static final HashSet REQUEST_QUERY_PARAMS = new HashSet<>(Arrays.asList("lang", "lon", "lat", "radius", "query_string_filter", "distance_sort", "limit")); public ReverseRequestFactory(List supportedLanguages, String defaultLanguage) { this.languageResolver = new RequestLanguageResolver(supportedLanguages, defaultLanguage); } - public R create(Request webRequest) throws BadRequestException { + public ReverseRequest create(Request webRequest) throws BadRequestException { for (String queryParam : webRequest.queryParams()) { - if (!m_hsRequestQueryParams.contains(queryParam)) - throw new BadRequestException(400, "unknown query parameter '" + queryParam + "'. Allowed parameters are: " + m_hsRequestQueryParams); + if (!REQUEST_QUERY_PARAMS.contains(queryParam)) + throw new BadRequestException(400, "unknown query parameter '" + queryParam + "'. Allowed parameters are: " + REQUEST_QUERY_PARAMS); } String language = languageResolver.resolveRequestedLanguage(webRequest); @@ -70,7 +70,6 @@ public R create(Request webRequest) throws BadRequest } String queryStringFilter = webRequest.queryParams("query_string_filter"); - ReverseRequest reverseRequest = new ReverseRequest(location, language, radius, queryStringFilter, limit, locationDistanceSort); - return (R) reverseRequest; + return new ReverseRequest(location, language, radius, queryStringFilter, limit, locationDistanceSort); } } diff --git a/src/main/java/de/komoot/photon/searcher/BaseElasticsearchSearcher.java b/src/main/java/de/komoot/photon/searcher/BaseElasticsearchSearcher.java index c446047ca..47f0c6aac 100644 --- a/src/main/java/de/komoot/photon/searcher/BaseElasticsearchSearcher.java +++ b/src/main/java/de/komoot/photon/searcher/BaseElasticsearchSearcher.java @@ -1,5 +1,6 @@ package de.komoot.photon.searcher; +import de.komoot.photon.elasticsearch.PhotonIndex; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; @@ -19,7 +20,7 @@ public BaseElasticsearchSearcher(Client client) { public SearchResponse search(QueryBuilder queryBuilder, Integer limit) { TimeValue timeout = TimeValue.timeValueSeconds(7); - return client.prepareSearch("photon"). + return client.prepareSearch(PhotonIndex.NAME). setSearchType(SearchType.QUERY_AND_FETCH). setQuery(queryBuilder). setSize(limit). diff --git a/src/main/java/de/komoot/photon/searcher/ReverseElasticsearchSearcher.java b/src/main/java/de/komoot/photon/searcher/ReverseElasticsearchSearcher.java index ae7ac9170..b08051898 100644 --- a/src/main/java/de/komoot/photon/searcher/ReverseElasticsearchSearcher.java +++ b/src/main/java/de/komoot/photon/searcher/ReverseElasticsearchSearcher.java @@ -1,6 +1,7 @@ package de.komoot.photon.searcher; import com.vividsolutions.jts.geom.Point; +import de.komoot.photon.elasticsearch.PhotonIndex; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; @@ -25,7 +26,7 @@ public SearchResponse search(QueryBuilder queryBuilder, Integer limit, Point loc Boolean locationDistanceSort) { TimeValue timeout = TimeValue.timeValueSeconds(7); - SearchRequestBuilder builder = client.prepareSearch("photon").setSearchType(SearchType.QUERY_AND_FETCH) + SearchRequestBuilder builder = client.prepareSearch(PhotonIndex.NAME).setSearchType(SearchType.QUERY_AND_FETCH) .setQuery(queryBuilder).setSize(limit).setTimeout(timeout); if (locationDistanceSort) diff --git a/src/main/java/de/komoot/photon/utils/ConvertToJson.java b/src/main/java/de/komoot/photon/utils/ConvertToJson.java index e1d992923..7a5bd0749 100644 --- a/src/main/java/de/komoot/photon/utils/ConvertToJson.java +++ b/src/main/java/de/komoot/photon/utils/ConvertToJson.java @@ -18,9 +18,9 @@ */ @Slf4j public class ConvertToJson { - private final static String[] KEYS_LANG_UNSPEC = {Constants.OSM_ID, Constants.OSM_VALUE, Constants.OSM_KEY, Constants.POSTCODE, Constants.HOUSENUMBER, Constants.COUNTRYCODE, Constants.OSM_TYPE}; - private final static String[] KEYS_LANG_SPEC = {Constants.NAME, Constants.COUNTRY, Constants.CITY, Constants.DISTRICT, Constants.LOCALITY, Constants.STREET, Constants.STATE, Constants.COUNTY}; - private final static String[] NAME_PRECEDENCE = {"default", "housename", "int", "loc", "reg", "alt", "old"}; + private static final String[] KEYS_LANG_UNSPEC = {Constants.OSM_ID, Constants.OSM_VALUE, Constants.OSM_KEY, Constants.POSTCODE, Constants.HOUSENUMBER, Constants.COUNTRYCODE, Constants.OSM_TYPE}; + private static final String[] KEYS_LANG_SPEC = {Constants.NAME, Constants.COUNTRY, Constants.CITY, Constants.DISTRICT, Constants.LOCALITY, Constants.STREET, Constants.STATE, Constants.COUNTY}; + private static final String[] NAME_PRECEDENCE = {"default", "housename", "int", "loc", "reg", "alt", "old"}; private final String lang; public ConvertToJson(String lang) { diff --git a/src/test/java/de/komoot/photon/ESBaseTester.java b/src/test/java/de/komoot/photon/ESBaseTester.java index c9907b9c0..fccefe09b 100644 --- a/src/test/java/de/komoot/photon/ESBaseTester.java +++ b/src/test/java/de/komoot/photon/ESBaseTester.java @@ -7,6 +7,7 @@ import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.PrecisionModel; import de.komoot.photon.elasticsearch.Importer; +import de.komoot.photon.elasticsearch.PhotonIndex; import de.komoot.photon.elasticsearch.Server; import lombok.extern.slf4j.Slf4j; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -26,7 +27,6 @@ public class ESBaseTester { public final String clusterName = "photon-test"; - private final String indexName = "photon"; private Server server; @@ -90,7 +90,7 @@ protected Client getClient() { } protected void refresh() { - getClient().admin().indices().refresh(new RefreshRequest(indexName)).actionGet(); + getClient().admin().indices().refresh(new RefreshRequest(PhotonIndex.NAME)).actionGet(); } /**