Module: BlacklightMaps::MapsSearchBuilderBehavior

Extended by:
ActiveSupport::Concern
Defined in:
lib/blacklight/maps/maps_search_builder.rb

Instance Method Summary collapse

Instance Method Details

#add_spatial_search_to_solr(solr_parameters = {}) ⇒ Object

add spatial search params to solr


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/blacklight/maps/maps_search_builder.rb', line 10

def add_spatial_search_to_solr(solr_parameters = {})
  if blacklight_params[:spatial_search_type] && blacklight_params[:coordinates]
    solr_parameters[:fq] ||= []
    if blacklight_params[:spatial_search_type] == 'bbox'
      solr_parameters[:fq] << blacklight_config.view.maps.coordinates_field + ":" + blacklight_params[:coordinates]
    else
      solr_parameters[:fq] << "{!geofilt sfield=#{blacklight_config.view.maps.coordinates_field}}"
      solr_parameters[:pt] = blacklight_params[:coordinates]
      solr_parameters[:d] = blacklight_config.view.maps.spatial_query_dist
    end
  end
  solr_parameters
end