Skip to content

Commit

Permalink
Merge pull request #1311 from MITLibraries/engx-267-tacos
Browse files Browse the repository at this point in the history
Initial TACOS integration
  • Loading branch information
matt-bernhardt authored May 21, 2024
2 parents ace49a4 + 16e9e9c commit e1318ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ to construct thumbnail URLs.
- `RESULTS_PER_BOX`: defaults to 3
- `SENTRY_DSN`: logs exceptions to Sentry
- `SENTRY_ENV`: Sentry environment for the application. Defaults to 'unknown' if unset.
- `TACOS_URL`: The GraphQL endpoint for the [TACOS](https://github.com/mitlibraries/tacos/) application.
- `TIMDEX_TIMEOUT`: value to override the 6 second default for TIMDEX timeout.

## Confirming functionality after updating dependencies
Expand All @@ -94,4 +95,5 @@ bin/rails test

The following additional manual testing should be performed in the PR build on Heroku.

- search for a few different terms and confirm results return and are displayed in each of the boxes as appropriate. Not all boxes should return results for all searches, but comparing to production should lead to the same results (although there is a cache in production so if results don't match you might want to first clear the production cache before being overly concerned)
- Search for a few different terms and confirm results return and are displayed in each of the boxes as appropriate. Not all boxes should return results for all searches, but comparing to production should lead to the same results (although there is a cache in production so if results don't match you might want to first clear the production cache before being overly concerned)
- If the app is integrated with TACOS, the browser console should include a response from that system confirming the search string and source system.
9 changes: 9 additions & 0 deletions app/views/search/_trigger_tacos.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$.ajax({
type: "POST",
url: "<%= ENV.fetch('TACOS_URL', '') %>",
contentType: 'application/json',
data: '{ "query": "{ logSearchEvent( searchTerm: \\"<%= params[:q] %>\\" sourceSystem: \\"bento\\" ) { phrase } }" }',
dataType: 'json'
}).fail(function (xhr, textStatus ) {
console.log(xhr);
});
5 changes: 5 additions & 0 deletions app/views/search/bento.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@
<%= render partial: "trigger_search", locals: { target: 'timdex', id: 'aspace_content'} %>

<%= render partial: "trigger_hint" %>

<% if ENV.has_key?('TACOS_URL') %>
<%= render partial: "trigger_tacos" %>
<% end %>

</script>

0 comments on commit e1318ec

Please sign in to comment.