solr - 加号登录 solr 查询未正确处理

标签 solr

全部:

我是 Solr 的新手,当我使用导入一些随机文档的 solr 示例时,我在 q 中使用搜索查询,例如:

fund+report

fund和+之间没有空格,我以为它会在文档中搜索一个词“fund+report”,这种情况在文档中很少发生,但是返回的结果很多,查询url是:

http://localhost:8983/solr/collection1/select?q=fund%2Breport&fl=id+filename+%5Bexplain%5D&wt=xml&indent=true

我认为 Solr 对待我的查询就像:

fund report

fund OR report

谁能告诉我为什么 solr 会这样对待我的查询?以及如何让 solr 将 fund+report 视为一个词?

谢谢

最佳答案

HTTP 调用将简单地将 + 转换为空格 。如果您需要一个实际的 + 符号,那么您需要使用 + 的 URL 编码值(我认为是 %2B)。如果您要查找短语 fund report,那么您需要在该短语周围加上双引号,例如,"fund report"。这些也应该是 URL 编码的(我认为它的值是 %22)。

请记住,如果您使用词干提取,那么搜索 "fund report" 将找到 "funds reports""funding reports " 等。但也许这就是您想要的。

总而言之,您的 URL 可能如下所示:

http://localhost:8983/solr/collection1/select?q=%22fund%20report%22&fl=id,filename,%5Bexplain%5D&wt=xml&indent=true

请注意,为 fl 参数列出的字段应该以逗号分隔。我不确定为什么 explain 字段周围有方括号。

关于solr - 加号登录 solr 查询未正确处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27827347/

相关文章:

solr - 通配符选择 Solr 中的所有项目

solr - 为什么 solr RemoveDuplicatesTokenFilterFactory 不起作用?

Solr 的地理空间格式器不起作用?

java - 生成新索引时 SOLR master 中偶尔出现 SocketTimeoutException

windows - 从网络目录轮询

java - Solr:使用 block 连接子查询解析器

solr - 如何使用Solr的CurrencyField并避免 "missing required field"错误

ssl - Alfresco & Solr SSL 证书握手超时

windows - 配置在 Tomcat 和 Windows 上运行的 Solr

尝试提交文件时出现 Solr fatal error