我有一个问题:
http://localhost:8983/solr/example/select?q=title:"King Kong"&wt=json
结果是一个文档返回。
我有两个问题:
http://localhost:8983/solr/example/select?q=title:"Snow Queen"&wt=json
结果是一个文档返回。
我正在尝试遵循本教程:
http://www.solrtutorial.com/solr-query-syntax.html
根据我的理解,这表明我应该这样做:
http://localhost:8983/solr/example/select?q=title:"King Kong" or title:"Snow Queen"&wt=json
然而它产生0结果。实际上这个有效载荷出错:
metadata: [
"error-class",
"org.apache.solr.common.SolrException",
"root-error-class",
"org.apache.solr.common.SolrException"
],
msg: "undefined field text",
code: 400
如果我尝试更换“#”或“'用'和'或添加括号。
但如果这样做:
http://localhost:8983/solr/example/select?&q=title:"King Kong" title:"Snow Queen"&wt=json
它有效,结果是正确的。
换句话说,http请求中的正确语法是什么,可以传递或者查询和/或查询。
答案 0 :(得分:0)
偶然我学会了解决方案:
http://localhost:8983/solr/example/select?q=title:"King Kong" OR title:"Snow Queen"&wt=json
或更复杂的案例:
http://localhost:8983/solr/example/select?q=title:"King Kong" OR (title:"Snow Queen" AND type:"Fairy tale")&wt=json
简而言之,大写字母确实有意义。 ; - )