SunSpot solr中的延迟索引仍会在记录保存时生成删除请求

时间:2012-04-04 07:30:39

标签: sunspot-rails websolr

延迟索引工作正常,但记录保存它会向websolr发送一些删除请求...此处显示日志

SOLR请求(14.3ms)[path =#parameters = {data:消息547488,标题:{“Content-Type”=>“text / xml”},方法:post,params:{:wt =&gt ;:ruby},查询:wt = ruby​​,path:update,uri:http://index.websolr.com/solr/index/update?wt=ruby,open_timeout:,read_timeout:}]

SOLR请求(12.4ms)[path =#parameters = {data:消息547488,标题:{“Content-Type”=>“text / xml”},方法:post,params:{:wt =&gt ;:ruby},查询:wt = ruby​​,path:update,uri:http://index.websolr.com/solr/index/update?wt=ruby,open_timeout:,read_timeout:}]

SOLR请求(9.7ms)[path =#parameters = {data:,headers:{“Content-Type”=>“text / xml”},方法:post,params:{:wt =>: ruby},查询:wt = ruby​​,path:update,uri:http://index.websolr.com/solr/index/update?wt=ruby,open_timeout:,read_timeout:}]

这些是针对单个邮件创建的3个请求。

这是我的搜索块

searchable :if => proc { |message| !message.user_messages.blank? } do

text :message_body do
  CGI.escape(self.body || "")
end
text :subject do
  CGI.escape(self.subject || "")
end

text :sender_name do
  user.blank? ? "" : user.full_name 
end

integer :users_ids, :multiple => true do
  user_messages.map{|um| um.user_id}
end
time :created_at
end handle_asynchronously :solr_index

请尽快查看,

感谢

1 个答案:

答案 0 :(得分:1)

要使用DelayedJob对Sunspot删除进行排队,您还应该添加以下行:

handle_asynchronously :remove_from_index