我是 Sunspot 的新手,基于他们的 wiki https://github.com/sunspot/sunspot。
"If you are using Rails, objects are automatically indexed to Solr as a part of the save callbacks."
但这对我在对象上调用 save 时不起作用,我必须手动运行 Object.reindex 才能在搜索结果中找到记录。我错过了什么吗?
谢谢
控制台日志
SQL (0.6ms) INSERT INTO "toons" ("author", "created_at", "flag_id", "icon_s3_path", "json", "name", "state", "toon_type", "updated_at", "user_id", "uuid", "view_count") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" [["author", "2333333"], ["created_at", Thu, 15 Aug 2013 22:49:40 UTC +00:00], ["flag_id", nil], ["icon_s3_path", nil], ["json", "[json]"], ["name", "2222222"], ["state", "created"], ["toon_type", "animation"], ["updated_at", Thu, 15 Aug 2013 22:49:40 UTC +00:00], ["user_id", 2], ["uuid", "2111112222"], ["view_count", nil]]
SOLR Request (25.6ms) [ path=#<RSolr::Client:0x007fc37bb71920> parameters={data: <?xml version="1.0" encoding="UTF-8"?><add><doc><field name="id">Toon 21</field><field name="type">Toon</field><field name="type">ActiveRecord::Base</field><field name="class_name">Toon</field><field name="created_at_d">2013-08-15T22:49:40Z</field><field name="name_text">2222222</field><field name="author_text">2333333</field></doc></add>, headers: {"Content-Type"=>"text/xml"}, method: post, params: {:wt=>:ruby}, query: wt=ruby, path: update, uri: http://localhost:8982/solr/update?wt=ruby, open_timeout: , read_timeout: , retry_503: , retry_after_limit: } ]
SOLR Request (2.9ms) [ path=#<RSolr::Client:0x007fc37bb71920> parameters={data: <?xml version="1.0" encoding="UTF-8"?><add><doc><field name="id">Toon 21</field><field name="type">Toon</field><field name="type">ActiveRecord::Base</field><field name="class_name">Toon</field><field name="created_at_d">2013-08-15T22:49:40Z</field><field name="name_text">2222222</field><field name="author_text">2333333</field></doc></add>, headers: {"Content-Type"=>"text/xml"}, method: post, params: {:wt=>:ruby}, query: wt=ruby, path: update, uri: http://localhost:8982/solr/update?wt=ruby, open_timeout: , read_timeout: , retry_503: , retry_after_limit: } ]
(7.5ms) COMMIT