【发布时间】:2013-07-31 06:54:44
【问题描述】:
使用 sphinx 2 遇到此错误
sphinxql: syntax error, unexpected IDENT, expecting CONST_INT or CONST_FLOAT or '-' near 'WI AND published = 1 AND sphinx_deleted = 0 LIMIT 0, 10; SHOW META'
index.html.erb
在部分集合行的模板中抛出错误:@posts_by_state,但同一部分的其他两个实例运行良好。状态排序是它的失败之处。
posts_controller.rb
@posts_by_state = Post.search(params[:search], with: { state: current_user.state, published: true }, :page => params[:page], :per_page => 10)
post_index.rb
ThinkingSphinx::Index.define :post, :with => :active_record do
indexes :title, as: :post_title
indexes :desc, as: :description
indexes tags(:name), as: :tag_name
#indexes happening_on, sortable: true
#has author_id, published_at
has published_at
has last_touched
has state
has published
set_property:field_weights => {
:post_title => 5,
:description => 1,
:tag_name => 10
}
end
【问题讨论】:
-
是的,我认为这可能是问题所在,但不知道解决方案。
标签: ruby-on-rails-3 thinking-sphinx