Skip to content

Commit

Permalink
The facet pub_date_t is also needed for the search result
Browse files Browse the repository at this point in the history
  • Loading branch information
Anusha Ranganathan committed Mar 18, 2016
1 parent e24c417 commit 4159064
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class CatalogController < ApplicationController
years_2: { label: '2nd', fq: 'pub_date_t:[100 TO 199]' },
years_1: { label: '1st', fq: 'pub_date_t:[0 TO 99]' }
}
config.add_facet_field 'pub_date_t', label: 'Publication Year', range: {
num_segments: 21,
assumed_boundaries: [0, 2999],
segments: true
}

# Have BL send all facet field names to Solr, which has been the default
# previously. Simply remove these lines if you'd rather use Solr request
Expand Down Expand Up @@ -111,11 +116,6 @@ class CatalogController < ApplicationController

def index
if on_home_page
blacklight_config.add_facet_field 'pub_date_t', label: 'Publication Year', range: {
num_segments: 21,
assumed_boundaries: [0, 2999],
segments: true
}
manuscripts
annotations
plot_data
Expand Down Expand Up @@ -159,6 +159,7 @@ def plot_data
@data_ticks = []
@pointer_lookup = []
@slider_ticks = []
@boundaries = []
# @slider_labels = []
data.each do |val|
@data_array << [val[:count], val[:from]]
Expand All @@ -176,7 +177,9 @@ def plot_data
# @slider_labels << label
@pointer_lookup << { 'from': val[:from], 'to': val[:to], 'count': val[:count], 'label': "#{val[:from]} to #{val[:to]}" }
end
@boundaries = [@data_array.first.last, @data_array.last.last]
if @data_array.any?
@boundaries = [@data_array.first.last, @data_array.last.last]
end
end

def solr_range_queries_to_a(solr_field)
Expand Down

0 comments on commit 4159064

Please sign in to comment.