I've recently installed thinking-sphinx on my ruby on rails app. As first sight, everything works great, I can search words and it will find them. Now, when I try to add some filters(such as, for example, provinces, categories, etc) using:
MyModel.search 'hello' :conditions => 'categor开发者_运维技巧y_id=1'
for example, it will throw me the following exception:
searchd error (status: 1): invalid or truncated request
I've been reading some docs on the thinking-sphinx plugin, and I guess I have to do something else than this syntax.
To summarize: until the moment, I just installed the windows service, then I defined a index in one model, and then i tried to search. Again, I succeeded while searching without conditions, but failed while searching with.
Any help will be appreciated.
Thanks, Brian
Assuming your model has category_id
:
MyModel.search 'hello', :with => {:category_id => 1}
:conditions
is for full text searching specific attributes, :with
is for filtering search results.
More info here: http://freelancing-gods.com/posts/a_concise_guide_to_using_thinking_sphinx
精彩评论