示例中的用法如下:
Redis::Search.query("Post", params[:q], :conditions => {:user_id => 12})
要实现的功能是根据某些条件,随机获取一条信息。
redis-search 链接: https://github.com/huacnlee/redis-search/wiki/Usage-in-Chinese
if params[:q].blank? # 这里搞 else Redis::Search.query("Post", params[:q], :conditions => {:user_id => 12}) end