Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for geodistance search to GraphQL #788

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Add support for geodistance search to GraphQL #788

merged 2 commits into from
Feb 12, 2024

Conversation

matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented Feb 12, 2024

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:

  • Geospatial search alone
  • Geospatial search combined with a search term
  • Confirming that the geodistance type imposes a requirement for those three fields (by omitting the distance parameter)

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

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    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)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

matt-bernhardt and others added 2 commits February 9, 2024 17:16
** 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:
  - Geospatial search alone
  - Geospatial search combined with a search term
  - Confirming that the geodistance type imposes a requirement for those
    three fields (by omitting the distance parameter)

** 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.
@mitlib mitlib temporarily deployed to timdex-pr-788 February 12, 2024 18:40 Inactive
@matt-bernhardt matt-bernhardt requested review from JPrevost and jazairi and removed request for JPrevost February 12, 2024 18:51
@JPrevost JPrevost self-assigned this Feb 12, 2024
@matt-bernhardt matt-bernhardt merged commit b4cfbb7 into main Feb 12, 2024
3 of 4 checks passed
@matt-bernhardt matt-bernhardt deleted the gdt-162 branch February 12, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants