검색 용으로 인덱싱 된 두 개의 모델 (사용자 및 항목)이 있습니다. 전 모델에 걸쳐 지리적 검색 할 노력하고있어 :ThinkingSphinx로 여러 모델을 어떻게 검색합니까?
ThinkingSphinx::Search.search('keywords', :geo => [ degrees_to_radians(params[:lat].to_f), degrees_to_radians(params[:lon].to_f) ], )
을하지만 난 단지 오류 얻을 : 각 모델은 개별적으로 잘 작동 검색
Sphinx Error: index item_core,item_delta,user_core,user_delta: unknown latitude attribute ''
을 ...하지만 난 ' 이 문제가 뭔지 전혀 몰랐습니다.
사용자 색인 :
define_index do
indexes [:first_name, :last_name], :as => :name
indexes login
indexes email
indexes headline
indexes description
indexes business.name, :as => :business_name
indexes [addresses.street_1, addresses.street_2, addresses.city, addresses.postal_code], :as => :address
has created_at, :sortable => true
has addresses.latitude, :as => :latitude, :type => :float
has addresses.longitude, :as => :longitude, :type => :float
set_property :delta => true
end
항목 지수 :
define_index do
indexes title, :sortable => true
indexes description
indexes [address.street_1, address.street_2, address.city, address.postal_code], :as => :address
indexes images.title, :as => :image_titles
indexes images.description, :as => :image_descriptions
indexes categories(:name), :as => :category_names
has price, :sortable => true
has created_at, :sortable => true
has address.latitude, :as => :latitude, :type => :float
has address.longitude, :as => :longitude, :type => :float
has categories(:id), :as => :category_ids
where "`items`.`state` = 'for_sale'"
set_property :delta => true
end