太阳黑子无法索引has_many关联

时间:2013-08-23 02:41:53

标签: ruby-on-rails sunspot

我想在像这样的模型上索引has_many关联,但是当我按标签名称搜索它时找不到记录:

searchable do
  text :name, :author, :toon_type
  text :tags_names do
    tags.map(&:name)
  end
  time :created_at
end

有什么想法吗?我的标签是通过标记模型的多态关联是一个问题吗?

由于

更新

我通过object.index在我的日志中手动索引控制台:

SOLR请求(5.3ms)[path =#parameters = {data:Toon 86ToonActiveRecord :: BaseToon2013-08-22T22:46:09Zapapabearanimation,headers:{“Content-Type”=>“text / xml”},方法:post,params:{:wt =>:ruby},查询:wt = ruby​​,path:update,uri:xxx:8982 / solr / update?wt = ruby​​,open_timeout :, read_timeout :, retry_503:,retry_after_limit :}]

搜索方法

@search = Sunspot.search(Toon) do
  fulltext params[:search]
  order_by :created_at, :asc
  # with(:created_at).less_than Time.now
  # with(:created_at).greater_than(1.week.ago)
  paginate :page => params[:page], :per_page => 9
end
@toons = @search.results

搜索请求:

SearchController处理#结果为HTML   参数:{“utf8”=>“✓”,“ga_client_id”=>“”,“搜索”=>“testerabc”}   用户负载(0.5ms)SELECT“users”。* FROM“users”WHERE“users”。“id”= 5 LIMIT 1   SOLR请求(43.9ms)[path =#parameters = {data:fq = type%3AToon& sort = created_at_d + asc& q = testerabc& fl =%2A + score& qf = name_text + author_text + toon_type_text + tags_text& defType = dismax& start = 0& rows = 9,method:post,params:{:wt =>:ruby},query:wt = ruby​​,headers:{“Content-Type”=>“application / x-www- form-urlencoded; charset = UTF-8“},path:select,uri:localhost:8982 / solr / select?wt = ruby​​,open_timeout :, read_timeout:,retry_503:,retry_after_limit:}]

0 个答案:

没有答案