Think Sphinx 多个表单字段
一直在努力解决这个问题...
表单截图: https://i.sstatic.net/PBWMW.jpg
字段名称/ID: 名称 |电子邮件 |公司 ID | user_type
控制器:
@users = User.search(params[:name], params[:email], params[:company_id], params[:user_type])
模型:
define_index do
indexes :name
indexes :email
indexes :company_id
indexes :user_type
end
执行此操作的正确方法是什么,已搜索文档但找不到任何有用的信息:(
Have been really struggling with this...
Form screenshot: https://i.sstatic.net/PBWMW.jpg
Field name's/id's:
name | email | company_id | user_type
Controller:
@users = User.search(params[:name], params[:email], params[:company_id], params[:user_type])
Model:
define_index do
indexes :name
indexes :email
indexes :company_id
indexes :user_type
end
What is a proper way of doing this, have searched documentation but could not find any useful information :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 Sphinx 按字段搜索最简单的方法是传递哈希值。您可以消除nil-s以确保thinking_sphinx将查看传入的请求
The simplest searching method by fields through Sphinx is to pass a hash. You can eliminate nil-s to ensure that thinking_sphinx will be looking through the incoming request