Add support for geodistance search to GraphQL #788
Merged
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.
Why are these changes being introduced:
We recently added support for a geodistance search to the OpenSearch model, and now we need to enable that support within GraphQL.
Relevant ticket(s):
https://mitlibraries.atlassian.net/browse/gdt-162
How does this address that need:
This defines a Geodistance type, with three fields: a distance (as a string), a latitude value (a float), and a longitude value (also a float).
The Geodistance type is then added as an argument of the search field, allowing GraphQL consumers to conduct searches geospatially.
We add three tests to support this functionality:
Document any side effects to this change:
This may be the first time we are using Float as a field type in GraphQL? It seems that we use String elsewhere even when the input is numeric. I'm not sure this is good pracrice, so I wanted to propose that we use a float here.
There are no tests to confirm that the latitude and longitude fields are required, as it seems unlikely that this requirement would not be met in practice. The distance parameter feels the most likely to be omitted.
Developer
our guide and
all issues introduced by these changes have been resolved or opened as new
issues (link to those issues in the Pull Request details above)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO