1

我在 ruby​​-on-rails 2.3.2 和 Windows 7 电脑上安装了 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 服务以防万一,所以应用程序,只是为了确保一切都被刷新。

提前致谢,

布赖恩

4

1 回答 1

1

我以为是 :conditions => {:province_id => 1}

于 2010-04-08T16:27:36.163 回答