QueryParser 和 API 有什么区别?
On step 3 of this tutorial the author writes:
I personally would use the QueryParser when the search string is supplied by the user, and I’d use directly the API when the query is generated by your code.
Are there any benefits of using one over the other or is it just personal preference?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就像链接所说,如果您想允许用户输入自定义搜索作为文本字符串(即姓名:matt,年龄:[10 TO 80] 使用 QueryParser。
但是,如果您只需要允许预定义的查询,您可以直接在代码中创建它们,
这取决于您使用的查询类型以及它们是如何由用户、预定义等创建的。
It's like the link says, if you want to allow users to enter custom searches as text string (i.e Name:matt, Age:[10 TO 80] use the QueryParser.
However if you only need to allow pre-defined queries, you can create them directly in your code.
So it depends what sort of queries you are using and how they are made, by the user, pre-defined etc