Items can be linked to GEOGR_NAME authorities, which in turn can have geographic coordinates stored in them. We have the functionality to search for items around geographic coordinates, but currently the indexer only indexes coordinates stored in 034 in the item itself, not in any authorities linked to it. Embeding the coordinates from the GEOGR_NAME authority should have a negligible impact on the size of the index, and should make geo-tagging of items a lot easier.
Created attachment 170979 [details] [review] Bug 37821: Embed geographic coordinates from GEOGR_NAME authority when indexing records
Test plan: ## Preparation 1. Set up koha-testing-docker with --es8 2. Go to "The beginnings of Rome" in staff view (http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=140) 3. Go to the linked authority record ("Rome -- History -- Kings, 753-510 B.C") by clicking the looking glass. Should end up at http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=169 4. Click "edit record" 5. Add field 034 ("CODED CARTOGRAPHIC MATHEMATICAL DATA") 6. For subfieds `s` and `t` enter the coordinates for Rome: 41.89193 and 12.51133 7. Save the authority record ## Testing 8. In koha-shell, issue the elasticsearch query: ``` curl -X GET "es:9200/koha_kohadev_biblios/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "bool": { "must": { "match_all": {} }, "filter": { "geo_distance": { "distance": "100km", "geolocation": { "lat": 41.89, "lon": 12.51 } } } } } } ' ``` Note no results. 9. Apply the patch 10. Rebuild the index with `koha-elasticsearch --rebuild kohadev` 11. Re-run the elasticsearch query 12. Notice the expected book pop up