{"id":23700741,"url":"https://github.com/redbox-mint/solr-geonames","last_synced_at":"2026-03-07T20:31:46.931Z","repository":{"id":4628184,"uuid":"5772402","full_name":"redbox-mint/solr-geonames","owner":"redbox-mint","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-26T08:07:18.000Z","size":195,"stargazers_count":12,"open_issues_count":7,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-03T04:38:25.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redbox-mint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/docker-compose.dev.yml","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-09-11T23:21:17.000Z","updated_at":"2025-04-29T04:04:38.000Z","dependencies_parsed_at":"2025-04-17T06:51:34.759Z","dependency_job_id":"cbb53f3c-cac1-4f14-aca7-4c7b0b7fae91","html_url":"https://github.com/redbox-mint/solr-geonames","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/redbox-mint/solr-geonames","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbox-mint%2Fsolr-geonames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbox-mint%2Fsolr-geonames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbox-mint%2Fsolr-geonames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbox-mint%2Fsolr-geonames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redbox-mint","download_url":"https://codeload.github.com/redbox-mint/solr-geonames/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbox-mint%2Fsolr-geonames/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30229741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T09:17:19.282Z","updated_at":"2026-03-07T20:31:46.892Z","avatar_url":"https://github.com/redbox-mint.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReDBox location service\n\nBuilt using [geonames](https://download.geonames.org/export/) \nindexed by [Apache Solr](https://solr.apache.org/).\n\n\n## Overview\n\nThe geonames service is used for autocomplete of place names.\n\nThese are the use cases:\n\n1. Select any place\n\n- Allow selection of any place in the world\n- In English\n- The autocomplete options should be distinguishable\n- The value stored is basic_name, latitude, longitude\n\n2. Select any country\n\n- Allow selection of any country\n- In English\n- The autocomplete options should be distinguishable\n- The value stored is basic_name, latitude, longitude\n\n\n## Implementation\n\nThe solr index includes these fields.\nThe fields are in ascii English, except for `utf8_name`, which can be in English or the language of the area.\n\n- basic_name: The stored identifier.\n- title: The basic title of the location.\n- latitude: latitude in decimal degrees (wgs84).\n- longitude: longitude in decimal degrees (wgs84).\n- feature_class_name: The name of the feature class.\n- feature_code_name: The name of the feature code.\n- country_name: The country name.\n- subdivision_name: The subdivision names.\n- display_title: The displayed title\n\nThe `display_title` should be used for displaying the location.\nThe `basic_name` should be used for storing the location.\n\nThe display title field is built from these fields, to try to make it unique.\n\nIt is a best-effort unique, not guaranteed.\n\nThe fields that might be used to construct the display title are:\n- feature_class_name\n- feature_code_name\n- country_name\n- subdivision_name\n\n## ReDBox config\n\nThe geonames lookup is usually used in a vocab field.\n\nHere are two configuration approaches.\n\n- sourceType: This indicates how to obtain the 'vocabulary' / 'autocomplete' items.\n- provider: This indicates where to look for the configuration.\n\nFor the 'external' sourceType and 'geonames' provider:\n\n- resultArrayProperty: This is the dotted path to extract from the response.\n- titleFieldName: This is the property to use for the 'value' / 'internal' name of each available option.\n- titleFieldArr: This is the array of fields to use to build the displayed title.\n- titleFieldDelim: This is the separator to use between the field values to build the displayed title.\n\nShow the full display title as the options, then the basic name as the selected option.\n\n```json\n{\n  \"class\": \"VocabField\",\n  \"definition\": {\n    \"disableEditAfterSelect\": false,\n    \"sourceType\": \"external\",\n    \"provider\": \"geonames\",\n    \"resultArrayProperty\": \"response.docs\",\n    \"titleFieldName\": \"basic_name\",\n    \"titleFieldArr\": [\n      \"display_title\"\n    ],\n    \"fieldNames\": [\n      \"basic_name\",\n      \"latitude\",\n      \"longitude\"\n    ],\n    \"stringLabelToField\": \"basic_name\"\n  }\n}\n```\n\nAnother approach: show the basic names as the options and the selected option.\n\n```json\n{\n  \"class\": \"VocabField\",\n  \"definition\": {\n    \"disableEditAfterSelect\": false,\n    \"sourceType\": \"external\",\n    \"provider\": \"geonames\",\n    \"resultArrayProperty\": \"response.docs\",\n    \"titleFieldName\": \"basic_name\",\n    \"titleFieldArr\": [\n      \"basic_name\"\n    ],\n    \"fieldNames\": [\n      \"basic_name\",\n      \"latitude\",\n      \"longitude\"\n    ],\n    \"stringLabelToField\": \"basic_name\"\n  }\n}\n```\n\n## Backward Compatibility\n\nThe existing ReDBox fields show the 'basic_name' as the options,\nand also store the basic_name as the value.\n\nThe basic_name is not unique - it is the name used for a variety of\ntypes of places (feature classes and codes).\n\nThis means that after the options and values gain more information,\nexisting stored data cannot be matched to single item.\n\nThis should be ok, as the selection is not tied to the autocompelete options,\nthe stored value will remain until a new option is chosen from the new \nautocomplete options that have more information.\n\n\n## Development and Testing\n\nTo run tests:\n\n```shell\n# Run the mocha tests\nnpm run test\n\n# remove the mocha test output\nnpm run test:clean\n\n# remove the solr data, so the next test run can start from a known point\nnpm run data:destroy\n```\n\nTo run local development:\n\n```shell\n# start the solr and nginx servers\nnpm run dev\n\n# In another terminal:\n\n# This will download the geonames data files if they aren't already present\nnpm run data:download\n\n# run solr-geonames to populate the solr index\ntime npm run dev:populate\n\n# stop the solr and nginx servers\nnpm run dev:clean\n\n# (optional) remove the solr data, so the next dev run can start from a known point\nnpm run data:destroy\n```\n\nTo clean up the local data:\n\n```shell\n# This will remove all the dev data, except the geonames data files\n# If you want new geonames data files, remove the existing files manually and then run `npm run data:download`\nnpm run data:destroy\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbox-mint%2Fsolr-geonames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredbox-mint%2Fsolr-geonames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbox-mint%2Fsolr-geonames/lists"}