SolrNet - 如何禁用 SolrQueryByField 中的引号?
我正在使用 SolrQueryByField 来测试 Solr 在搜索特定字段时的执行情况。然而,SolrQueryByField 似乎在多词查询周围应用引号。最终的网址类似于.. select?q=(prodname:"champion+creatine") ...这尝试进行精确匹配。有没有办法禁用 SolrQueryByField 中的引号,以便将其转换为 .. select?q=(prodname:champion+creatine)。谢谢!
I am using SolrQueryByField to test how Solr performs when searching particular fields. However SolrQueryByField seems to apply quotes around multi-word query. The final url has something like.. select?q=(prodname:"champion+creatine") ... This try to do an exact match. Is there a way to disable quotes in SolrQueryByField so that it translates into .. select?q=(prodname:champion+creatine). Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 SolrNet 中执行以下操作:
这将产生:
这应该可以实现您想要的。如果没有,请参阅 SolrNet - 查询页面了解更多选项。另外,我相信您看到问题中描述的行为的原因是因为
SolrQueryByField
执行特殊字符转义。编辑:使用评论中提到的 SolrQueryByField 修复。 (确保您有支持此功能的 SolrNet 版本...
You can do the following in SolrNet:
Which will produce:
This should accomplish what you want. If not, please reference the SolrNet - Querying page for more options. Also, I believe the reason you are seeing the behavior described in your question is because
SolrQueryByField
performs special character escaping.Edit: Using fix for SolrQueryByField mentioned in comment. (Make sure you have a version of SolrNet that supports this…