Skip to content

Commit

Permalink
remove unused place_id from AddressRow
Browse files Browse the repository at this point in the history
  • Loading branch information
lonvia committed Dec 5, 2020
1 parent fd87818 commit f03f398
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class NominatimConnector {
private static final String SELECT_COLS_PLACEX = "SELECT place_id, osm_type, osm_id, class, type, name, housenumber, postcode, address, extratags, ST_Envelope(geometry) AS bbox, parent_place_id, linked_place_id, rank_address, rank_search, importance, country_code, centroid";
private static final String SELECT_COLS_OSMLINE = "SELECT place_id, osm_id, parent_place_id, startnumber, endnumber, interpolationtype, postcode, country_code, linegeo";
private static final String SELECT_COLS_ADDRESS = "SELECT p.place_id, p.name, p.class, p.type, p.rank_address";
private static final String SELECT_COLS_ADDRESS = "SELECT p.name, p.class, p.type, p.rank_address";

private final DBDataAdapter dbutils;
private final JdbcTemplate template;
Expand Down Expand Up @@ -183,7 +183,6 @@ public List<PhotonDoc> getInterpolationsByPlaceId(long placeId) {

List<AddressRow> getAddresses(PhotonDoc doc) {
RowMapper<AddressRow> rowMapper = (rs, rowNum) -> new AddressRow(
rs.getLong("place_id"),
dbutils.getMap(rs, "name"),
rs.getString("class"),
rs.getString("type"),
Expand Down
16 changes: 1 addition & 15 deletions src/main/java/de/komoot/photon/nominatim/model/AddressRow.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package de.komoot.photon.nominatim.model;

import com.google.common.base.MoreObjects;
import lombok.Data;

import java.util.Arrays;
import java.util.Map;

/**
Expand All @@ -13,8 +11,6 @@
*/
@Data
public class AddressRow {
private static final String[] USEFUL_CONTEXT_KEYS = new String[]{"boundary", "landuse", "place"}; // must be in alphabetic order to speed up lookup
private final long placeId;
private final Map<String, String> name;
private final String osmKey;
private final String osmValue;
Expand All @@ -33,16 +29,6 @@ private boolean isPostcode() {
}

public boolean isUsefulForContext() {
return !name.isEmpty() && !isPostcode() && Arrays.binarySearch(USEFUL_CONTEXT_KEYS, osmKey) >= 0;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("placeId", placeId)
.add("name", name)
.add("osmKey", osmKey)
.add("osmValue", osmValue)
.toString();
return !name.isEmpty() && !isPostcode();
}
}

0 comments on commit f03f398

Please sign in to comment.