Comments (10)
I think this makes a lot of sense. There's no jbuilder view current for articles so the default format=json
is outputing the raw EDS field names, etc.
For the guest vs. non-guest, we could implement an opensearch
controller endpoint and always use guest mode for it. I think we get that method for "free" in Blacklight::Catalog
from sul-bento-app.
Just a simple test that adding the route get '/article/opensearch' => 'article#opensearch'
yields the search with titles without any modifications/overrides.
query for engine with JSON response
from sul-bento-app.
This was my understanding of open-search, that it would just effectively return values to be sent to the search endpoint as the query, and not necessarily a set of metadata that we could use to drive a richer results display.
from sul-bento-app.
We get the built-in support for RSS and ATOM on the index
endpoint -- though it's not working on article search by default (exception: undefined method 'show_solr_document_url'
). Either of those formats would provide more structure, at least title/description/link.
from sul-bento-app.
@drh-stanford I don't believe they have a representation of the facet response though, do they?
from sul-bento-app.
No, the "channel" details are slim in those formats.
I didn't realize that we need facet values in the response. The built-in Blacklight JSON support sounds like the way to go for that.
Maybe it's just a matter of implementing a different controller method that would either always use guest mode, or use a proxy header (X-Forwarded-For
) for the IP address validation. Rails' request.remote_ip
already checks for those headers (see https://apidock.com/rails/ActionDispatch/RemoteIp and https://github.com/sul-dlss/SearchWorks/blob/article-search/app/controllers/article_controller.rb#L210). We could also check that the IP address matched the Bento box servers to protect against spoofing.
from sul-bento-app.
👍 there is already some IP spoofing protection in rails, which we'll need to make sure we don't accidentally trigger.
from sul-bento-app.
@jkeck I have the start of a branch going here: https://github.com/sul-dlss/sul-bento-app/compare/1-eds-search
It implements an ArticleSearchService
class, that you can call like so:
response = ArticleSearchService.new.search('my query')
response.results # Array of Hash with :title, :description, :url for each hit
response.facets # Array of Solr Hash for facets
response.body # raw JSON
One thing it doesn't have is a way to select which facet fields you want back in the query. I haven't figured out how/whether the JSON API supports that.
You need a config/settings.local.yml
that looks like so:
EDS_QUERY_URL: 'http://localhost:3000/article?q=%{q}&rows=%{max}&format=json'
EDS_FETCH_URL: 'http://localhost:3000/article/%{id}'
from sul-bento-app.
I added a demo controller that you can use to drive the engine -- http://localhost:3001/demo/article_search?q=cats
for example. But the theming is screwed up -- the background and foreground colors are blue
from sul-bento-app.
Closing this as the leftover tasks (facets) is ticketed in a separate issue.
from sul-bento-app.
Related Issues (20)
- [sul-bento-app/prod] OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired) HOT 1
- Replace "COVID-19 Libraries update" text in nav bar with "2021 Access"
- Guides no results link should go to guides homepage
- Update Yewno widget HOT 2
- standardize term for e-books HOT 1
- Migrate Universal Analytics (UA) to Google Analytics 4 (GA4) HOT 5
- Earthworks results in Bento Box HOT 1
- Valid Earthworks result URLs not created in Bento results
- Replace Earthworks image
- Migrate off sassc to dart sass
- Upgrade to Bootstrap 5
- use new Drupal 9 endpoints for Library Website search results HOT 3
- Javascript error
- Clean up D9 migration code
- D9 footer links update
- Update link for "More search tools"
- Display Stanford "S" for stanford-only links HOT 1
- Help button doesn't rotate like it does in SW
- Extra white bar at bottom of footer
- Set a user-agent on Faraday requests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sul-bento-app.