1

我用Rails 3 工作在我的模型中的一個標籤,我有的Rails太陽黑子搜索項標記爲

acts_as_taggable_on :hashtags 

和索引我有

searchable :auto_index => false do 
    text :tags do 
    "#{hashtags.map(&:name).to_sentence}" 
    end 
    integer :tag_ids, :references => ActsAsTaggableOn::Tag, :multiple => true do 
    [hashtag_ids].flatten 
    end 
end 

當我做標記太陽黑子搜索項目這個模型

Sunspot.search(Modelname) do 
    with :tag_ids, 1 
end 

上面沒有列出的項目

但是對於其他車型相同的作品具有

acts_as_taggable_on :tags 

如何來解決這個問題。同樣在標籤中,上下文是標籤(其他模型)和主題標籤(具有acts_as_taggable_on的模型:主題標籤)。

+0

是auto_index中意思是在這種情況下,假的呢? – 2012-05-14 05:51:15

+0

你有沒有設法得到這個工作? – Noz 2012-07-12 15:49:27

回答

1

嘗試這樣:

searchable do 
    string :hashtag_list, :multiple => true, :stored => true 
end 

那麼這應該返回結果

ModelName.solr_search do 
with :hashtag_list, ["tag1", "tag2"] 
end