Add optional -street-housenumber-full import switch - #1099
Conversation
45011af to
8d07f27
Compare
In countries that split a building's address into a conscription (descriptive) number and a street (orientation) number, Nominatim also exposes the two joined as a combined house number such as `2531/80` (e.g. Czechia and Slovakia). Before the multi-address rework in 0.7.0, that combined form was indexed and searchable; since then street addresses are indexed with the plain street number only. This adds an opt-in `-street-housenumber-full` import switch. When enabled, street addresses that carry a separate street number are indexed with the full combined house number instead of the plain street number. The house number analyzer splits the combined form on the delimiter, so the address is still found by the street number, the conscription number or the combined form. Ordinary addresses without a separate street number are unaffected. Disabled by default, so existing behaviour is unchanged. The switch is threaded through all three import paths (Nominatim import, Nominatim update, JSON dump import) and persisted in the database properties so incremental updates keep the same behaviour.
8d07f27 to
19e8a24
Compare
|
@henrik242 may I ask you for a code review pls? |
|
It's holiday season at the moment, it might take a couple of weeks. |
Ok, thanks for the reply |
I think @lonvia is better suited to answer this, since I don't know the full implications. It seems to me that it could be solved without the |
|
There really is no need for a switch here. To my knowledge, Just to clarify. say you have a full tagging like: What combinations of number and street/place would you expect a user to search for here? And what is the street-based and place-based address, you would expect to be displayed? |
Thanks for clarifying. For the Czech Republic, I would expect the following searches to work for this example:
The reason is that all three house number variants ( However, once a street is present, I would not expect users to search for For display, I would expect:
So from my perspective, all three number representations should remain searchable when a street address exists, because they are all used by end users and external address datasets. Previously, Photon supported searches for both |
|
Okay, so basically, it's better to completely ignore
The display for place-based addresses would come out as |
|
Agreed — and it turns out two of the three cases are already implemented, so this needs almost no new code:
So the whole change is one argument in the addPlaceAddress(base, address, "conscriptionnumber");
- addStreetAddress(base, address, "streetnumber");
+ addStreetAddress(base, address, "housenumber");plus updating I have reopened #1098 with exactly that, so the switch and all the plumbing here can go. The remaining tests are unaffected, since One case that is not test-covered and does change behaviour: (Drafted with AI assistance and reviewed by me, per the contribution guidelines.) |
|
Solved in #1098 |
What this does
Adds an opt-in import switch
-street-housenumber-fullthat indexes street-basedaddresses with the full combined house number (e.g.
2531/80) instead of the plainstreet number.
Disabled by default — existing behaviour is unchanged for everyone who does not set it.
Why
In countries that split a building's address into a conscription (descriptive) number
and a street (orientation) number, Nominatim exposes the two joined as a combined house
number such as
2531/80(e.g. Czechia and Slovakia).Before the multi-address rework in #884 (released in 0.7.0), that combined form was indexed
and therefore searchable. Since then, street addresses are indexed with the plain street
number only, so the combined form is no longer found. For CZ/SK data this is a regression:
users routinely search by the full
2531/80form.Why opt-in rather than changing the default
The 0.7.0 rework deliberately assigns the conscription number to the place context and the
street number to the street context. This PR does not revert that decision — it only adds
an alternative, off-by-default indexing for the street number, so:
a separate street number (the conscription/orientation split);
How it works
When enabled, an address that has a separate
streetnumberis indexed with itshousenumbervalue (
2531/80) on the street instead of the barestreetnumber. The house number analyzer(
index_housenumber) splits the combined form on the delimiter, so the address is still foundby the street number, the conscription number or the full combined form — no extra
documents needed.
Ordinary addresses without a separate street number are left on the existing generic path
untouched.
The switch is threaded through all three import paths (Nominatim import, Nominatim update,
JSON dump import) and persisted in the database properties, so incremental updates keep the
same behaviour.
Testing
testConscriptionAddresskept unchanged (verifies the default is untouched).testConscriptionAddressWithFullStreetHousenumber(switch on →34/50on the street).testFullStreetHousenumberIgnoredWithoutStreetNumber(switch on must not changeordinary addresses).
docs/usage.md../gradlew buildpasses.AI assistance disclosure
Per the contribution guidelines: this PR was prepared with AI assistance. The implementation,
the tests and this PR description were drafted with an AI coding assistant and then reviewed and
verified by me. All AI-assisted parts are the code and text of this PR in full.
Verification on a live installation
Verified end-to-end on a running photon server (embedded OpenSearch), not only in unit tests.
A small JSON dump with one Czech conscription address was imported twice — once with the
default settings and once with
-street-housenumber-full— and the running server was queriedover HTTP.
Test address (
addresspart of the dump):street=Kaprova, city=Praha, conscriptionnumber=2531, streetnumber=80, housenumber=2531/80.-street-housenumber-fullKaprova 2531/80802531/80Kaprova 80802531/80Kaprova 2531(conscription no.)2531/80So with the default the conscription number
2531is not searchable at all and the combinedform is never returned; with the switch enabled the address is found by the street number, the
conscription number or the full combined form, and the canonical
2531/80is returned. Thecombined value is indexed once — the house number analyzer splits it, so no duplicate documents
are created.
DatabasePropertiesafter import confirms the persisted setting:streetHousenumberFull=true(and
falsefor the default import), so incremental updates keep the same behaviour.Related
keeps it opt-in and gated on the presence of a street number, so it is additive and safe for
all other data. Happy to consolidate with Use housenumber instead of streetnumber for street addresses #1098 whichever direction the maintainers prefer.