1
我想添加一个时间戳字段到我的模型索引太阳黑子/索尔。 Solr的扼流圈就这个问题和产生NumberFormatException
:太阳黑子/索尔:索引时间字段结果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;相同的结果。
3年后,此答案仍然相关,并且该错误仍存在。我为此在Github上开了一个问题。 – Cec
修复工作对我来说也差不多5年之后!放置这个覆盖这个在我的模型的顶部,在类定义之前。使用Solr 6.0.1 /太阳黑子2.2.7 – KPheasey
又一年通过,我们仍然面临同样的问题,你的修复仍然有效,但为什么这个代码不能从config/initializer/sunspot/type.rb文件中工作。 – user1969191