fix: use geocoding field for geo data in address detail response#2
Open
sweets9 wants to merge 1 commit into
Open
fix: use geocoding field for geo data in address detail response#2sweets9 wants to merge 1 commit into
sweets9 wants to merge 1 commit into
Conversation
The GNAF dataset stores geocoding data under structured.geocoding but the address detail handler was only checking structured.geo, causing attributes.geo to always be absent from GET /addresses/:id responses. Fall back chain: geocoding → geo (for forward compat) Fixes bradleyhodges#1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1
Problem
GET /addresses/:idreturns nogeocoordinates even withADDRESSKIT_ENABLE_GEO=1set. The GNAF dataset stores geocoding data understructured.geocodingin OpenSearch, but the address detail handler was checkingstructured.geo— a field that doesn't exist in the indexed documents.Root cause
In
dist/cli.js(~line 40620), the handler that builds the address detail response:Inspecting the OpenSearch index confirms the actual field name is
geocoding:{ "structured": { "geocoding": { ... }, ... } }Fix
Testing
Verified against AddressKit v3.0.1 with GNAF Jan 2026 dataset on OpenSearch 2.11.0. After applying this patch,
GET /addresses/:idcorrectly returnsattributes.geowith latitude/longitude coordinates.Note: this PR patches the compiled
dist/cli.jsas the TypeScript source doesn't appear to be in the repo. Happy to raise a source-level fix if you can point me to the right file.