Autocomplete API
- CMR-6157Getting issue details... STATUS
The CMR autocomplete API will provide autocomplete suggestions via a RESTful call to an AWS Lambda.
A secondary implementation will use WebSockets. The WebSocket implementation is a stretch goal.
If the WebSocket implementation is completed, the data format for the responses will share the same response schema as the RESTful implementation.
OpenAPI 3.0
View with https://editor.swagger.io/ or using Docker with
docker container run --rm -p 80:8080 swaggerapi/swagger-editor
/search/collections/autocomplete
Query with a term
Fetch autocomplete suggestions from all available facets
curl -XGET https://.../search/collections/autocomplete?q=ex
Example Response
{ "query": "ex", "results": [ { "type": "platform", "suggestions": [ "EXOS-A", "EXPLORER-9" ] }, { "type": "instrument", "suggestions": [ "EXRAD" ] }, { "type": "provider", "suggestions": [ "PURDUE/EXTENSION" ] } ] }
Query with type filter
Only return suggestions from the supplied type
curl -XGET https://.../search/collections/autocomplete?q=ice&type=instrument
{ "query": "ice", "results": [ { "type": "instrument", "suggestions": [ "ICE AUGER", "ICE SCANNER" ] } ] }
Query with multiple types
Multiple types may be specified. The order of types provided may not reflect order returned in results array. Only valid facets will be used, unrecognized terms will not be included in results.
curl -XGET https://.../search/collections/autocomplete?q=sol&type=platform,instrument
{ "query": "sol", "results": [ { "type": "platform", "suggestions": [ "SOLAR-A", "SOLSAT" ] }, { "type": "instrument", "suggestions": [ "SOLARIZER" ] } ] }
Query with no results
curl -XGET https://.../search/collections/autocomplete?q=foo
{ "query": "foo", "results": [] }
/search/collections/autocomplete/type
curl -XGET https://.../search/collections/autocomplete/types
[ "platform", "project", "instrument", "spatial_keyword", "provider" ]
Architecture
AWS Lambda provides the logic for hosting and interacting with Redis and returning responses.
A Redis cache will keep the entries available for rapid search and retrieval.