我有一个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.
更多推荐
发布评论