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 ability to batch search Rummager #855
Conversation
lib/gds_api/rummager.rb
Outdated
searches.each_with_index do |search, index| | ||
url_friendly_search = {} | ||
url_friendly_search[index] = search | ||
url_friendly_searches << url_friendly_search |
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.
It took me a while to understand this. Maybe clearer to use:
url_friendly_searches << { index => search }
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.
This would certainly work.
lib/gds_api/rummager.rb
Outdated
# | ||
# # @see https://github.com/alphagov/rummager/blob/master/doc/search-api.md | ||
def batch_search(searches, additional_headers = {}) | ||
url_friendly_searches = [] |
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.
Might be clearer to do
url_friendly_searches = searches.each_with_index.map do |search, index|
{ index => search }
end
5d5b0e4
to
678e9f2
Compare
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.
Would be good to get an entry in the CHANGELOG
too. I'm going to do a release of gds-api-adapters today, I can include this in if you want?
678e9f2
to
9f374e2
Compare
This commit enables the new batch search endpoint to be called on Rummager, where each of the individual queries to be batched is encoded in a readable string as part of the query string. Co-authored-by: Oscar Wyatt <oscar.wyatt@digital.cabinet-office.gov.uk>
9f374e2
to
cc3286f
Compare
Note: this is all ready to go, but we want to hold off merging this until the Rummager change has been merged. |
This commit enables the new batch search endpoint to be called on Rummager, where each of the individual queries to be batched is encoded in a readable string as part of the query string.
Co-authored-by: Oscar Wyatt oscar.wyatt@digital.cabinet-office.gov.uk
Trello: https://trello.com/c/QlPhl3wp/122-add-batchsearch-method-to-gds-api-adaptors