ruby-on-rails 2.3.2 と Windows 7 PC に Sphinx と Thinking Sphinx をインストールしました。
まず、rake ts:start を実行しても、まったく起動しません。「開始しています...」と言い続け、起動しません。それでも、単純な検索 (フィルタリングも条件もなし) は正常に機能します。フィルターを追加しようとすると、レコードが返されません。
私のモデルは次のようになります。
class Announcement < ActiveRecord::Base
belongs_to :announcement_type
belongs_to :user
belongs_to :province
has_many :announcement_favorites
has_many :announcement_comments
has_many :announcement_subscriptions
has_many :announcement_views
acts_as_taggable_on :tags #,:category
validates_presence_of :title, :description, :expirationDate
define_index do
indexes title, :as => :title, :sortable => true
indexes description, :as => :description, :sortable => true
has province_id, :as => :province_id
end
そして、私はこの方法で検索しています:
Announcement.search params[:announcement][:search].to_s, :with => {:province_id => 1} ,:page => params[:page], :per_page => 10
Thinking Sphinx が持っているすべての優れたドキュメントと、それについて読んだすべての投稿に基づいて、自分が何を間違っているのか理解できません。
インデックスを変更した後、 rake ts:index 、 ts:config コマンドを実行し、念のため searchd Windows サービスを再起動し、アプリケーションを再起動して、すべてが更新されていることを確認することを明確にしたいだけです。
前もって感謝します、
ブライアン