2013-03-18 122 views
0

這是一個真正的noob問題,但我無法找到的文檔明確迴應:思維獅身人面像搜索模型對象

是否有可能使用思維斯芬克斯通過模型對象的關聯進行搜索。

例:

@user.posts.search("I'm confused") 

我看到會涉及搜索用戶的所有實例。

+0

HTTPS:/ /github.com/pat/thinking-sphinx結帳使用情況 – pablomarti 2013-03-18 22:37:18

回答

0

yes可以通過模型對象的關聯進行搜索,如示例索引是針對上傳模型關聯創建的。

define_index做 索引標題 索引描述 索引uploads.file_file_name,:爲=>:upload_file_name 索引uploads.file_content_type,:爲=>:upload_file_content_type

has :id 
has price 
has user_id 
has created_at 
has purchase_count 
has images.photo_file_size 
has tags.id, :as => :tag_id, :facet => true 
has tags.parent_id, :as => :tag_parent_id, :facet => true 
has "state='active'", :as => :active, :type => :boolean, :facet => true 
has "count(images.id) > 0", :as => :has_image, :type => :boolean 
has "sum(uploads.file_file_size)", :as => :total_size, :type => :integer 

相關問題