2012-08-11 4 views
0

레일스에서 ​​태그 동의어를 처리하는 적절한 방법은 무엇입니까? 모델을 Situation이라고하며 태그에 대해서는 acts_as_taggable_on을 사용하고 검색에는 ThinkingSphinx를 사용합니다. rains에서 생각한 sphinx의 동의어 태그

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 
을하는 데 도움이