Skip to content
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

Adding facets to advanced search 6.x messes up the @documents variable #64

Open
sandbergja opened this issue Sep 26, 2016 · 1 comment

Comments

@sandbergja
Copy link

Hi all,

When I add the following lines into my catalog_controller, the @documents variable that is passed to my citation view and the bookmarks display suddenly includes every single document in my solr index(!) This had not been a problem with Blacklight and advanced_search 5.x; only ran into it when I upgraded both to 6.x. I am using rails 4.2, by the way.

        config.advanced_search = {
          :form_solr_parameters => {
            "facet.field" => ["format", "language_facet"],
            "facet.limit" => -1, # return all facet values
            "facet.sort" => "index" # sort by byte order of values
          }
        }

Steps to reproduce:

  1. rails _4.2.5_ new not_working
  2. cd not_working
  3. Add gem "blacklight_advanced_search", '~> 6.0' and gem 'blacklight', '~>6.6' to your Gemfile.
  4. rails generate blacklight_advanced_search and rails generate blacklight:install --devise
  5. rake db:migrate
  6. Add those lines (or something similar; I have tried different values for all of the facet.* configurations) to catalog controller.
  7. Try visiting bookmarks, where you will note that every single document in the index is suddenly visible in your bookmarks!
  8. Try going to localhost:3000/catalog/some_document_id/citation. You'll not that it returns citations for the first 10 documents in your index, rather than the requested document.

Any suggestions? Thanks in advance for your help!

@afred
Copy link

afred commented Mar 16, 2017

Not sure if this is related, but I'm finding that having an advanced field named "format" really screws things up.

This is because blacklight_advanced_search uses Rails URL helpers to generate urls. When you pass in a hash to the URL helpers that has, say {"format" => "some_value"}, it will append .some_value to your URL.

For me, this was creating some broken links that, when followed, would result in a ActionController::UnknownFormat error. But I imagine it could cause other strange chaos as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants