Skip to content

Commit

Permalink
Add publication_date to the Solr attributes whitelist and add a regre…
Browse files Browse the repository at this point in the history
…ssion test. Fixes #50.
  • Loading branch information
jure committed Oct 3, 2014
1 parent f1b8f33 commit 68dc153
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/solr_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions spec/lib/solr_query_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 68dc153

Please sign in to comment.