diff --git a/lib/solr_request.rb b/lib/solr_request.rb index 43961a5..8e43658 100644 --- a/lib/solr_request.rb +++ b/lib/solr_request.rb @@ -46,7 +46,7 @@ class SolrRequest WHITELIST = [ :everything, :author, :author_country, :institution, :publication_days_ago, :datepicker1, :datepicker2, :subject, :cross_published_journal_name, - :financial_disclosure, :title + :financial_disclosure, :title, :publication_date ] # Creates a solr request. The query (q param in the solr request) will be based on diff --git a/spec/lib/solr_query_builder_spec.rb b/spec/lib/solr_query_builder_spec.rb index a19efcc..56aa85a 100644 --- a/spec/lib/solr_query_builder_spec.rb +++ b/spec/lib/solr_query_builder_spec.rb @@ -140,4 +140,22 @@ def build_page_block_test_once(params, expected) qb.build qb.sort.should eq("&sort=publication_date%20desc") end + + it "doesn't ignore publication_date parameter (regression test for issue #50)" do + params = { + everything: "cancer", + author: "", + author_country: "", + institution: "", + subject: "", + cross_published_journal_name: "All Journals", + financial_disclosure: "", + publication_date: "[2014-09-03T14:01:32Z TO 2014-10-03T14:01:32Z]" + } + qb = SolrQueryBuilder.new(params) + qb.build.should eq( + "everything:cancer AND publication_date:[2014-09-03T14:01:32Z TO " \ + "2014-10-03T14:01:32Z]" + ) + end end