-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adds opensearch geo_bounding_box query support #789
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a fiddly question about the refutation test, but I don't think it is a blocking concern. If you'd rather merge this as-is rather than make a change, I'm fine with that.
test/models/opensearch_test.rb
Outdated
@@ -279,6 +279,8 @@ class OpensearchTest < ActiveSupport::TestCase | |||
os.instance_variable_set(:@params, | |||
{ geodistance: { latitude: '42.361145', longitude: '-71.057083', distance: '50mi' } }) | |||
|
|||
refute(os.matches.to_json.include?('{"multi_match":{"query":"rail stations","fields":')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent of this test is to confirm that the query builder isn't hallucinating a keyword search? I think I can understand that motivation, but wonder if there's a smaller string match to look for - like maybe refute on just multi_match
or something. The way this reads right now, I think hallucinating a search for popcorn would pass the test - as long as it doesn't hallucinate rail stations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I narrowed it down and am just squashing/merging without a review as it was so minor. Thanks again.
} | ||
end | ||
|
||
# https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-geo-distance-query.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird that they haven't created a page for this type of search, but I see what you're talking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect the Docs licensing didn't allow a fork so I believe OpenSearch had to throw away all the docs and start over whereas with the code they had the fork... so docs required a lot of work to build back up.
@matt-bernhardt I agree with your comment. I added that explicitly to make the pairs of tests more clear as to what was happening in the method being tested between the two, but you are absolutely correct that the |
Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/GDT-167 How does this address that need: * Adds an optional geo_bounding_box search to our existing opensearch query builder
1f82cf6
to
92794b3
Compare
This has not yet been integrated with GraphQL, so the best way to validate this work is to use the rails console. To test locally, you'll need an opensearch instance running with appropriate data loaded.
You can also combine keyword (or filters) using our existing query syntax:
Relevant ticket(s):
How does this address that need:
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