Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:00:30+00:00 2026-05-28T07:00:30+00:00

I am looking to utilize Solr for both text and geospatial searching in a

  • 0

I am looking to utilize Solr for both text and geospatial searching in a Rails 3.1 app. I see that websolr supports geo-spatial indexing & searches but the two gems for it (sunspot & rsolr) do not seem to (currently) implement it. Sunspot appears to be in the process of adding the functionality but claims that “[geospatial is] experimental and unreleased. The DSL may change.”

Are there other implementations of geospatial searching with sunspot + websolr? I’ve done a bit of googing and come across some but they seem hackish and I’d rather not use what I’ve found if there is already a core feature being baked in or a more supported approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:00:31+00:00Added an answer on May 28, 2026 at 7:00 am

    Sunspot does support geo-spatial search, with some limitations.

    Indexing:

    searchable do
      text :location
      location :coordinates do
        Sunspot::Util::Coordinates.new latitude, longitude
      end
    end
    

    Search:

    coord = # whatever...
    with(:coordinates).near(coord[0], coord[1], :precision => 3)
    

    But it’s really not precise… It’s using geo hashes if I’m not mistaken. So it’s possible that 2 points are close from each other but are not found.
    Also, you can’t nest near in facets.

    I would follow the advice of ADAM and go for elastic search. That’s what I did. You get a lot more control.

    Tire also supports geospatial search, but there is no specific methods in the DSL, because it’s not needed. They plan to add them later I think.

    Indexing:

    tire.mapping do
        indexes :location, type: 'string', analyzer: 'snowball'
        indexes :latitude_longitude, type: 'geo_point'
    end
    
    def latitude_longitude
        [latitude, longitude].join(",")
    end
    
    def to_indexed_json
        to_json(methods: ['latitude_longitude'])
    end
    

    Search:

    filter :geo_distance, distance: "#{distance}km", latitude_longitude: [user.latitude, user.longitude].join(",")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into writing a small custom app for a small business that can
I'm looking to rewrite a pretty intensive CRUD type ASP.NET page to utilize ajax
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking for a Linux application (or Firefox extension) that will allow me to scrape
I'm attempting to utilize the socket.h functions within Windows. Essentially, I'm currently looking at
All programs that I develop utilize the default Windows Design template: Besides from changing
I'm looking for project suggestions that would force me to get my hands dirty
I was looking through some legacy code we have and I noticed something that
I have an application that sometimes will utilize a large amount of data. The
We are looking to utilize extensionless URL's for the first time in our organization.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.