GithubHelp home page GithubHelp logo

Comments (10)

drh-stanford avatar drh-stanford commented on May 29, 2024

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.

drh-stanford avatar drh-stanford commented on May 29, 2024

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

screen shot 2017-08-02 at 2 18 50 pm

from sul-bento-app.

jkeck avatar jkeck commented on May 29, 2024

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.

drh-stanford avatar drh-stanford commented on May 29, 2024

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.

jkeck avatar jkeck commented on May 29, 2024

@drh-stanford I don't believe they have a representation of the facet response though, do they?

from sul-bento-app.

drh-stanford avatar drh-stanford commented on May 29, 2024

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.

jkeck avatar jkeck commented on May 29, 2024

👍 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.

drh-stanford avatar drh-stanford commented on May 29, 2024

@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.

drh-stanford avatar drh-stanford commented on May 29, 2024

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.

jkeck avatar jkeck commented on May 29, 2024

Closing this as the leftover tasks (facets) is ticketed in a separate issue.

from sul-bento-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.