sul-dlss / earthworks

Geospatial discovery application for Stanford University Libraries.
https://earthworks.stanford.edu
Other
18 stars 3 forks source link

Smart autocomplete #1047

Open thatbudakguy opened 3 weeks ago

thatbudakguy commented 3 weeks ago

This is a brand-new feature to enhance the search experience, both from the homepage and search results page.

To try it out, visit the interactive prototype and click in the search bar to simulate typing.

The suggestions are grouped into categories:

For the latter, the most basic implementation would be to use values from the "Spatial coverage" field/facet. However, this won't result in a spatial search and won't move the map because those values are just metadata – they aren't tied to geospatial locations. We want to do more than this, if we can.

A more complete/featureful implementation would do geocoding, so that "New york (city)" and "New york (state)" could be matched to geospatial coordinates. When you selected each option, you would go to a search with the spatial facet active, as though you had already moved the map to the coordinates/bbox of the place you selected.

This deserves some thought re: implementation. We could query some kind of web service live during the autocomplete process, or we could pre-compute a list of known locations and their coordinates to make the process faster/simpler (but perhaps less complete).

Note that Stanford maintains its own geocoder service at https://sul-geocoding-web.stanford.edu/. It would be great to take advantage of this! There's more information on that page about how the service works; see in particular this page on the geocoding API. There is also a suggestion service that might be worth investigating.

Whatever we do, we probably want to take advantage of solr's built-in functionality for search suggestions.

thatbudakguy commented 3 weeks ago

Might be related to or synergize with #41.

thatbudakguy commented 2 weeks ago

re: the stanford geocoding service, @mapninja says:

Because of the way the data is licensed, we currently have 5 services, rather than a single global service. I’m trying to negotiate a global geocoder but that may not happen until next license cycle in Jan ’25. That means that you would have to figure out how to aggregate the autocomplete from all 5 services, in order to accommodate global placenames.

thatbudakguy commented 2 weeks ago

Evidently the ArcGIS Online (cloud) version of this API does have a /world endpoint, and because the APIs are the same, we could develop against/use that while the stanford-local one is being set up.

More info at: https://developers.arcgis.com/documentation/mapping-apis-and-services/geocoding/tutorials/search-for-an-address/