Answer the question
In order to leave comments, you need to log in
How to correctly form a query together with thinking_sphinx?
Here is my example:
Parameters: {"utf8"=>"✓", "query"=>"jjkhjkhjkhjhjhk", "start_date"=>"12/22/2016", "end_date"=>"12/08/2016" }
Controller: @posts = ThinkingSphinx.search(params[:query], :with => {:created_at => params[:start_date]..params[:end_date]})
Error: ActionView::Template::Error (sphinxql : syntax error, unexpected '/', expecting AND near '/22/2016 AND 12/08/2016 AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META' - SELECT * FROM `post_core` WHERE MATCH('jjkhjkhjkhjhjhk' ) AND `created_at` BETWEEN 12/22/2016 AND 12/08/2016 AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META):
******************************************************* ******************************************************* **************
If you need to look at the indexing, it is below, but I think the format from the params for the query on thinkingsphinx does not match. Who knows where the error crept up?
ThinkingSphinx::Index.define :post, :with => :real_time do
indexes title, as: :title_content
indexes body, as: :content
indexes comments.body, as: :comment_content
indexes created_at, sortable: true
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question