Sunspot/Solr 查询以逻辑运算符 AND/OR/NOT 结尾会导致错误
我注意到以 AND/OR/NOT 示例(“this AND”)等逻辑运算符结尾的查询将导致错误。现在处理这个问题的最佳方法是什么?只是删除或转义所有以其中之一结尾的查询吗?请注意,以这些单词之一开头的查询也会发生这种情况。有时,有效名称以此类词结尾,例如 Oregon OR。
I noticed that queries ending with logical operators like AND/OR/NOT example ('this AND') will result in an error. Now what would be the best way to handle this? Just trim out or escape all the queries ending with one of those? Note that it also happens for queries starting with one of these words. And sometimes, valid names end with such words, like Oregon OR.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信转义查询中不属于布尔逻辑的任何 AND/OR/NOT 实例将是您最好的选择:
请记住,在双引号字符串中转义 AND/OR/NOT 时,您需要两个反斜杠:
I believe escaping any AND/OR/NOT instances in your query that aren't meant to be boolean logic would be your best bet:
Keep in mind that when escaping AND/OR/NOT in double-quoted strings, you need two backslashes: