Skip to content

Commit

Permalink
Adds support for Solr's heatmap.distErrPct paramater.
Browse files Browse the repository at this point in the history
This config allows you to chage the distErrPct which controls the resolution of
returned box count values.
  • Loading branch information
mejackreed committed Oct 5, 2016
1 parent fdfbaee commit ae674e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def add_solr_facet_heatmap(solr_parameters = {})
if blacklight_params[:bbox]
solr_parameters['facet.heatmap'] = geometry_field
solr_parameters['facet.heatmap.geom'] = bbox_as_range
solr_parameters['facet.heatmap.distErrPct'] = dist_err_pct
solr_parameters[:bq] ||= []
solr_parameters[:bq] << "#{geometry_field}:\"IsWithin(#{bbox_as_envelope})\""
solr_parameters[:fq] ||= []
Expand All @@ -23,6 +24,10 @@ def add_solr_facet_heatmap(solr_parameters = {})
solr_parameters
end

def dist_err_pct
blacklight_config.heatmap_distErrPct || 0.15
end

def geometry_field
blacklight_config.geometry_field
end
Expand Down
1 change: 1 addition & 0 deletions lib/generators/blacklight_heatmaps/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def configuration
inject_into_file 'app/controllers/catalog_controller.rb', after: 'configure_blacklight do |config|' do
"\n # BlacklightHeatmaps configuration values" \
"\n config.geometry_field = :geo_srpt" \
"\n config.heatmap_distErrPct = 0.15 # Default Solr value" \
"\n # Basemaps configured include: 'positron', 'darkMatter', 'OpenStreetMap.HOT'" \
"\n config.basemap_provider = 'positron'" \
"\n config.show.partials.insert(1, :show_leaflet_map)" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
.to eq :geo_srpt
expect(subject.add_solr_facet_heatmap(solr_params)['facet.heatmap.geom'])
.to eq '["1 2" TO "4 3"]'
expect(subject.add_solr_facet_heatmap(solr_params)['facet.heatmap.distErrPct'])
.to eq 0.15
expect(subject.add_solr_facet_heatmap(solr_params)[:bq])
.to include(boost: 'stuff')
expect(subject.add_solr_facet_heatmap(solr_params)[:bq])
Expand Down

0 comments on commit ae674e1

Please sign in to comment.