ebsco / edsapi-ruby

A Ruby interface to the EBSCO Discovery Services API
MIT License
7 stars 10 forks source link

Add facets before initial search #81

Closed JPrevost closed 7 years ago

JPrevost commented 7 years ago

For a bento use case, the ability to pre-apply facets prior to doing an initial search is sometimes useful. I don't see how to do that with this gem.

I'm looking for something like:

session = EBSCO::EDS::Session.new
session.add_facet('SourceType', 'Books')  [in reality we add a bunch of facets at this step all OR'd together]
session.search(query: 'some search')

Do you think this is something that could be supported in the gem?

An example of what this looks like working with the API directly can be seen here: https://github.com/MITLibraries/bento/blob/master/test/vcr_cassettes/popcorn_books_paginated.yml#L97

Thanks for your consideration of this feature. I'd be happy to discuss further offline if that would be helpful.

bmckinney commented 7 years ago

There are a few ways to do this currently:

  1. using facet_filter
  2. using actions
  3. using add_facet

I think method 1 might be the best fit for your use case. What do you think?

JPrevost commented 7 years ago

@bmckinney facet_filters is exactly what I needed. Thanks!