简体   繁体   中英

tag synonyms in rails using thinking sphinx

What is a proper way to handle tag synonyms in rails? Model is called Situation, I use acts_as_taggable_on for tags and ThinkingSphinx for search.

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

but with proper ranking

something like that helps

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM