#117 ✓wontfix
Alan S

Distance Errors in Sunspot-Solr-Light

Reported by Alan S | May 7th, 2010 @ 03:55 AM | in Bugs

Sample file: http://github.com/astevens67/sunspot-spatial-test (just let me know when you have it and I will remove it).

I am still having four problems with solr-spatial-light, even after upgrading to the latest version for my local version of solr:

  1. I can run sunspot searches scoping with near, but I cannot get it to sort even though :sort => true. I know that #near is working on some level becuase I can scope with the distance attribute. However, when using :sort all I get is a listing of results by id in ascending order. Scoping with other attributes (with, without etc) works fine.

  2. I am getting hit#distance objects back showing 6620 when it should be between 5 and 1,500 miles. If I run the same coordinates in geokit I get the right distances.

  3. The distance for every single hit is the same (6620 miles), even though you will see each has a different lat/lng. I have also tried adding lat and lng to the searchable block, but this seems to make no difference. If I change the origin, the distance will change, but again it will be the same for all hits.

  4. You will see why I didn't format the hit#distance object as soon as you reload the page: the list renders but the hit#distance comes back nil. I have no idea why. However, Job.reindex will instantiate hit#distance objects on the following page reload. Also, I can reindex and see the distances the first time I load the page in firefox, and then if I bring up the same page of my local webrick server using Google Chrome I don't get distances, so it's probably not a browser problem, and my rails log shows no errors.

I also have been able to recreate the problems on a second, stripped-down instance, which I have uploaded to http://github.com/astevens67/sunspot-spatial-test.

It is rails 2.3.5 with sunspot-rails and will_paginate gems. I also created a seed file to populate the jobs table with 8 test under the jobs_controller (just run rake db:seed). I threw the search under search_controller.

Sunspot rails already had v0.0.4, but I followed the instructions in solr-spatial-light and upgraded to the 0.0.5 jar file. The only config change I made was in schema.xml where I changed both the existing lat/lang entries to stored="false" as in your guide.

If you get a chance please take a look and let me know if I am doing something wrong I have the config.gem setup in environment.rb and I did a rake gems:install, but maybe I missed a step somewhere. If the problem is human error I would appreciate any advice you might have.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Awesome Solr interaction for Ruby

People watching this ticket