ruby on rails 3 - sphinxql: syntax error, unexpected IDENT -
getting error sphinx 2
sphinxql: syntax error, unexpected ident, expecting const_int or const_float or '-' near 'wi , published = 1 , sphinx_deleted = 0 limit 0, 10; show meta'
index.html.erb
error being thrown in template @ line of partial collection: @posts_by_state, 2 other instances of same partial working great. state sort throwing off.
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 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
string attributes in sphinx can used sorting - not filtering, not grouping - , options work around follows:
- pull out associated model (state or poststate, perhaps?), , filter foreign key integer instead.
- store value field instead, , use :conditions instead of :with.
- hack around crc32 values.
i highly recommend first of these options (i'd argue it's cleaner, accurate), it's you.
Comments
Post a Comment