使用思维sphinx标记rails中的同义词

时间:2012-08-11 10:21:16

标签: ruby-on-rails sphinx thinking-sphinx synonym

在rails中处理标记同义词的正确方法是什么? 模型称为情境,我使用acts_as_taggable_on作为标签,使用ThinkingSphinx进行搜索。

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

但排名正确

1 个答案:

答案 0 :(得分: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