Skip to content

Commit ce3424b

Browse files
authored
Merge pull request #808 from lonvia/address-for-rank-0
Introduce 'other' rank for address rank 0 objects
2 parents d747059 + ba04e9b commit ce3424b

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ List of available layers:
313313
- county
314314
- state
315315
- country
316+
- other (e.g. natural features)
316317

317318
```
318319
http://localhost:2322/api?q=berlin&layer=city&layer=locality

src/main/java/de/komoot/photon/nominatim/model/AddressType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public enum AddressType {
1818
CITY("city", 13, 16),
1919
COUNTY("county", 10, 12),
2020
STATE("state", 5, 9),
21-
COUNTRY("country", 4, 4);
21+
COUNTRY("country", 4, 4),
22+
OTHER("other", 0, 0);
2223

2324
private final String name;
2425
private final int minRank;

src/test/java/de/komoot/photon/nominatim/NominatimConnectorDBTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ void testPlaceAddress() throws ParseException {
9999
AssertUtil.assertAddressName("Le Havre", doc, AddressType.STATE);
100100
}
101101

102+
@Test
103+
void testPlaceAddressAddressRank0() throws ParseException {
104+
PlacexTestRow place = new PlacexTestRow("natural", "water").name("Lake Tee").rankAddress(0).rankSearch(20).add(jdbc);
105+
106+
place.addAddresslines(jdbc,
107+
new PlacexTestRow("place", "county").name("Lost County").rankAddress(12).add(jdbc),
108+
new PlacexTestRow("place", "state").name("Le Havre").rankAddress(8).add(jdbc));
109+
110+
connector.readEntireDatabase();
111+
112+
assertEquals(3, importer.size());
113+
importer.assertContains(place);
114+
115+
PhotonDoc doc = importer.get(place);
116+
117+
AssertUtil.assertAddressName("Lost County", doc, AddressType.COUNTY);
118+
AssertUtil.assertAddressName("Le Havre", doc, AddressType.STATE);
119+
}
120+
102121
@Test
103122
void testPoiAddress() throws ParseException {
104123
PlacexTestRow parent = PlacexTestRow.make_street("Burg").add(jdbc);

src/test/java/de/komoot/photon/query/ReverseRequestFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void testWithBadLayerFilters() {
218218
Request mockRequest = createRequestWithLongitudeLatitude(-87d, 41d);
219219
requestWithLayers(mockRequest, "city", "bad");
220220

221-
assertBadRequest(mockRequest, "Invalid layer 'bad'. Allowed layers are: house,street,locality,district,city,county,state,country");
221+
assertBadRequest(mockRequest, "Invalid layer 'bad'. Allowed layers are: house,street,locality,district,city,county,state,country,other");
222222
}
223223

224224
@Test

0 commit comments

Comments
 (0)