Class: Solr::Query::Request::GeoFilter
- Inherits:
-
Object
- Object
- Solr::Query::Request::GeoFilter
- Includes:
- Support::SchemaHelper
- Defined in:
- lib/solr/query/request/geo_filter.rb
Constant Summary collapse
- SPATIAL_RADIUS =
roughly 100mi
161
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#spatial_radius ⇒ Object
readonly
Returns the value of attribute spatial_radius.
Instance Method Summary collapse
-
#initialize(field:, latitude:, longitude:, spatial_radius: SPATIAL_RADIUS) ⇒ GeoFilter
constructor
A new instance of GeoFilter.
- #to_solr_s ⇒ Object
Methods included from Support::SchemaHelper
Constructor Details
#initialize(field:, latitude:, longitude:, spatial_radius: SPATIAL_RADIUS) ⇒ GeoFilter
Returns a new instance of GeoFilter.
11 12 13 14 15 16 17 |
# File 'lib/solr/query/request/geo_filter.rb', line 11 def initialize(field:, latitude:, longitude:, spatial_radius: SPATIAL_RADIUS) @field = field @latitude = latitude @longitude = longitude @spatial_radius = spatial_radius freeze end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
9 10 11 |
# File 'lib/solr/query/request/geo_filter.rb', line 9 def field @field end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
9 10 11 |
# File 'lib/solr/query/request/geo_filter.rb', line 9 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
9 10 11 |
# File 'lib/solr/query/request/geo_filter.rb', line 9 def longitude @longitude end |
#spatial_radius ⇒ Object (readonly)
Returns the value of attribute spatial_radius.
9 10 11 |
# File 'lib/solr/query/request/geo_filter.rb', line 9 def spatial_radius @spatial_radius end |
Instance Method Details
#to_solr_s ⇒ Object
19 20 21 22 |
# File 'lib/solr/query/request/geo_filter.rb', line 19 def to_solr_s solr_field = solarize_field(@field) "{!geofilt sfield=#{solr_field} pt=#{@latitude},#{@longitude} d=#{spatial_radius}}" end |