Sha256: fb7e9af5d190bab3622a479977c5d2eaa2c33925a220de8cf1124772b6e7531e

Contents?: true

Size: 775 Bytes

Versions: 7

Compression:

Stored size: 775 Bytes

Contents

require 'bigdecimal'

shared_examples_for "spatial query" do
  it 'filters by radius' do
    search do
      with(:coordinates_new).in_radius(23, -46, 100)
    end

    expect(connection).to have_last_search_including(:fq, "{!geofilt sfield=coordinates_new_ll pt=23,-46 d=100}")
  end

  it 'filters by radius via bbox (inexact)' do
    search do
      with(:coordinates_new).in_radius(23, -46, 100, :bbox => true)
    end

    expect(connection).to have_last_search_including(:fq, "{!bbox sfield=coordinates_new_ll pt=23,-46 d=100}")
  end

  it 'filters by bounding box' do
    search do
      with(:coordinates_new).in_bounding_box([45, -94], [46, -93])
    end

    expect(connection).to have_last_search_including(:fq, "coordinates_new_ll:[45,-94 TO 46,-93]")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sunspot-2.7.1 spec/api/query/spatial_examples.rb
sunspot-2.7.0 spec/api/query/spatial_examples.rb
sunspot-2.6.0 spec/api/query/spatial_examples.rb
sunspot-2.5.0 spec/api/query/spatial_examples.rb
sunspot-2.4.0 spec/api/query/spatial_examples.rb
sunspot-2.3.0 spec/api/query/spatial_examples.rb
sunspot-2.2.8 spec/api/query/spatial_examples.rb