Skip to content

Commit

Permalink
Merge pull request #51 from articlemetrics/publication_date
Browse files Browse the repository at this point in the history
Add publication_date to the Solr attributes whitelist and add a regressi...
  • Loading branch information
jure committed Oct 3, 2014
2 parents f1b8f33 + 68dc153 commit 7e8b933
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 7e8b933

Please sign in to comment.