【发布时间】:2012-06-10 15:18:21
【问题描述】:
我正在尝试将时间戳字段添加到我的模型中,以便通过 Sunspot/Solr 进行索引。 Solr 对此感到窒息并产生NumberFormatException:
class Book < ActiveRecord::Base
attr_accessible :lastUpdated, :category, :title # etc...
searchable do
text :title
text :category
time :lastUpdated # mysql 'datetime' field
# etc...
end
end
Jun 06, 2012 10:59:10 AM org.apache.solr.common.SolrException log
SEVERE: java.lang.NumberFormatException: For input string: "2012-01-02T03:29:00Z"
我也尝试过使用date :lastUpdated,结果相同。
考虑到我的模型可能有一些虚假的lastUpdated 值,我尝试从Time.now 索引结果,并得到了相同的结果。
我在外部使用 Solr 3.4.0,但使用sunspot-installer 提供的“内部”Solr 重现了同样的问题,并相应地调整了sunspot.yml。我的情况看起来很像here 提到的问题,但是重新安装 Sunspot/Solr 配置似乎并不能解决它。
编辑:也尝试过针对 Solr 3.6.0;同样的结果。
【问题讨论】:
标签: ruby solr lucene sunspot sunspot-solr