2012-08-11 45 views
0

在軌道中處理標記同義詞的正確方法是什麼? 模型被稱爲情境,我使用acts_as_taggable_on標籤和ThinkingSphinx進行搜索。使用思維獅身人面像標記軌道中的同義詞

Situation.search :conditions => { :tag_name => '(synonym11 | synonym12) | (synonym21 | synonym22)' }, :match_mode => :boolean 

但適當的排名

回答

0

類似的東西可以幫助

define_index :main_index do 
    # fields 
    indexes :title 
    indexes :description 
    indexes user.name, :as => :author 

    # attributes 
    has id, user_id, created_at, updated_at 
end 

define_index :tag_index do 
    # fields 
    indexes taggings.tag.name, :as => :tag_name 

    # attributes 
    has id, user_id, created_at, updated_at 

    set_property :wordforms => 'db/synonyms.txt' 
end