本文介绍了太阳黑子地理空间搜索错误:未知字段"location_ll"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天来,我一直在尝试将地理空间搜索集成到我的Rails应用程序中,但是当我运行rake sunspot:solr:reindex时,会不断收到此错误消息

I've been trying to integrate geospatial search into my rails app for a few days now, but keep getting this error when I run rake sunspot:solr:reindex

RSolr::Error::Http - 400 Bad Request
Error: ERROR:unknown field 'location_ll'

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">Place 1</field><field   name=\"type\">Place</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">Place</field><field name=\"location_ll\">42.348065,-71.083623</field></doc> #etc... keeps going on for all the objects/fields being indexed in the table

据我所知,当我注释掉模型中的latlon(:location)行时,搜索和索引工作正常,但我不知道它是否是错误或是否丢失某物.以下是我当前正在使用的设置:

As far as I can tell I'm doing everything correctly as search and indexing works when I comment out the latlon(:location) line in my model, but don't know if its a bug or if I'm missing something. Below is the setup I'm currently using:

导轨3.2.1红宝石1.9.2p318

rails 3.2.1ruby 1.9.2p318

宝石黑子(2.0.0.pre.120417)sunspot_rails(2.0.0.pre.120417)sunspot_solr(2.0.0.pre.120417)

Gemssunspot (2.0.0.pre.120417) sunspot_rails (2.0.0.pre.120417) sunspot_solr (2.0.0.pre.120417)

:latitude和:longitude均为浮点格式

:latitude and :longitude are both in float format

放置模型

searchable do
text :name
latlon(:location) { Sunspot::Util::Coordinates.new(self.latitude, self.longitude) }
end

我已经尝试了太阳黑子::: Util :: Coordinates.new中的变体,包括(纬度,经度)和(纬度,经度)

I've tried variations in the Sunspot::Util::Coordinates.new, including (lat, lon) and (latitude, longitude)

我查看了 https://github.com/sunspot/sunspot/issues/203 并按照建议,停止我的sunspot服务器,删除solr文件夹,删除sunspot.yml,重新安装并重新启动,但是仍然出现错误.有任何想法吗?非常感谢你!

I took a look at https://github.com/sunspot/sunspot/issues/203 and as per the suggestions, stopped my sunspot server, deleted the solr folder, deleted the sunspot.yml, reinstalled, and restarted, but am still getting the error. Any ideas? Thank you very much!

推荐答案

确保solr文件夹中的schema.xml与此处的最新文件相匹配:

Make sure schema.xml in the solr folder matches the latest one from here:

https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/conf/schema.xml

仍然无法在我的本地主机上运行,​​但是它正在生产中

Still not working on my localhost, but it is on production

这篇关于太阳黑子地理空间搜索错误:未知字段"location_ll"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 09:12