检查元搜索列
关于 MetaSearch,我想从搜索参数中提取“人类”名称。例如,当 params[:search] 具有以下非空值时:
- title_contains
- author_name_contains
我想提取:
- title
- author name
最终用途是向用户提供额外的反馈,例如:
Results filtered on title and author name
我想使用其中的函数MetaSearch 库来实现这一点,而不是重新开发参数解析。虽然上述示例在 Ruby 中很简单,但 MetaSearch 参数语言可以富有表现力。
谢谢
Regarding MetaSearch, I would like to extract "human" names from the search parameters. For example, when the params[:search] has non-blank values for the following:
- title_contains
- author_name_contains
I would like to extract:
- title
- author name
The end use would be to provide additional feedback to the user such as:
Results filtered on title and author name
I would like to use functions within the MetaSearch library to achieve this instead of re-developing the param parsing. While the above examples are simple in Ruby the MetaSearch parameter language can be expressive.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您确实想从 MetaSearch 对象中获取这些内容,您可以执行以下操作:
不过,我不太确定您是否比直接从参数中获取这些内容获得了任何好处。在任何实际使用中,您可能希望根据谓词更改显示的文本。
您可能想使用 i18n 来解决这个问题:
http:// rdoc.info/github/ernie/meta_search/master/file/README.rdoc#Localization
If you really want to get these from the MetaSearch object, you can do something like:
I'm not really sure that you're gaining anything over pulling this from the params directly, though. In any real-world usage, you'd probably want to change the text you display based on the predicate.
You may want to tackle this using i18n, instead:
http://rdoc.info/github/ernie/meta_search/master/file/README.rdoc#Localization