solr中的空白问题(Problems with white space in solr)

编程入门 行业动态 更新时间:2024-10-27 12:38:51
solr中的空白问题(Problems with white space in solr)

我有一个solr4.8.0服务器的查询(使用curl ):

curl -g "http://192.168.0.70:8983/solr/solr_db/select?q=*:*&fl=some,fields,here&start=0&rows=5&fq=first_filter:first_value&fq=time_filter:[2016-11-21T22:00:00Z%20TO%202016-11-22T21:59:59Z]&fq=third_filter:third-value&fq=forth_filter:forth%20value"

如您所见,对于forth_filter:forth%20value查询过滤器( forth_filter:forth%20value ),有一个包含空格的值。 我使用URL转义方法( %20 )将其转义。 我在使用time_filter进行此转义之前使用time_filter 。

此查询给出错误:

“错误”:{

“msg”:“查询中未指定字段名称,并且未通过'df'param指定默认值”,

“代码”:400}

}

问题描述 :错误是由于forth_filter 。 我知道这个,因为如果我删除它,一切正常。 而且,如果我删除所有其他过滤器,但保留它,它仍然不起作用,导致相同的错误。 任何人都可以指导我如何解决这个问题吗?

NB我是通过PHP查询solr ,但为了解决这个问题,我首先尝试通过curl 。 通过PHP库查询,给出相同的错误输出。

I have this query to a solr4.8.0 server (using curl):

curl -g "http://192.168.0.70:8983/solr/solr_db/select?q=*:*&fl=some,fields,here&start=0&rows=5&fq=first_filter:first_value&fq=time_filter:[2016-11-21T22:00:00Z%20TO%202016-11-22T21:59:59Z]&fq=third_filter:third-value&fq=forth_filter:forth%20value"

As you can see, for the forth query filter (forth_filter:forth%20value), there is a value which contains white space. I escaped this using the URL escape method (%20). I used before this escape with time_filter.

This query gives an error:

"error":{

"msg":"no field name specified in query and no default specified via 'df' param",

"code":400}

}

Problem description: The error is due to forth_filter. I know this because if I remove it, everything works. And also, if I remove all other filters, but keep it, it still doesn't work, resulting in the same error. Can anybody guide me how to fix this problem?

N.B. I'm querying solr via PHP, but in order to fix this, I try it via curl first. Querying via PHP library, gives the same error output.

最满意答案

您可以通过将整个值包含在"" ,“ forth_filter:"forth value"或使用\ : forth_filter:forth\ value来转义空格。

You can escape spaces by either enclosing the whole value within "", forth_filter:"forth value" or using \: forth_filter:forth\ value.

更多推荐

本文发布于:2023-08-04 07:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413184.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:空白   solr   Problems   space   white

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!