ApacheSolrJSON查询本地参数
在Solr文档中,它重点解释了如何使用GET参数来定义查询,但对于如何使用更好的结构化JSON POST支持来完成相同的任务,它提供的信息很少。我找不到任何比表面解释更深入的文档 特别是,我试图在查询中使用本地参数,并想知道如何使用JSON POST而不是GET参数来完成以下操作:ApacheSolrJSON查询本地参数,solr,solrcloud,Solr,Solrcloud,在Solr文档中,它重点解释了如何使用GET参数来定义查询,但对于如何使用更好的结构化JSON POST支持来完成相同的任务,它提供的信息很少。我找不到任何比表面解释更深入的文档 特别是,我试图在查询中使用本地参数,并想知道如何使用JSON POST而不是GET参数来完成以下操作: http://localhost:8983/solr/city/query?sort={!sfield=location pt=35.5514,-97.4075}geodist() asc&q={!geofi
http://localhost:8983/solr/city/query?sort={!sfield=location pt=35.5514,-97.4075}geodist() asc&q={!geofilt sfield=location pt=35.5514,-97.4075 d=5}
根据您的查询,将映射到:
{
"sort": "{!sfield=location pt=35.5514,-97.4075}geodist() asc",
"query": "{!geofilt sfield=location pt=35.5514,-97.4075 d=5}"
}
根据您的查询,将映射到:
{
"sort": "{!sfield=location pt=35.5514,-97.4075}geodist() asc",
"query": "{!geofilt sfield=location pt=35.5514,-97.4075 d=5}"
}
为了完成@MatsLindh answer,您可以使用常用的参数名称,只要将它们包装在参数中,无需映射,例如: file.json
{
"params": {
"q":"{!geofilt sfield=location pt=35.5514,-97.4075 d=5}",
"sort":"{!sfield=location pt=35.5514,-97.4075}geodist() asc",
"wt": "json",
"indent": "true"
}
}
使用curl的请求示例:
curl -H "Content-Type: application/json" -X "POST" --data @file.json http://localhost:8983/solr/city/query
为了完成@MatsLindh answer,您可以使用常用的参数名称,只要将它们包装在参数中,无需映射,例如: file.json
{
"params": {
"q":"{!geofilt sfield=location pt=35.5514,-97.4075 d=5}",
"sort":"{!sfield=location pt=35.5514,-97.4075}geodist() asc",
"wt": "json",
"indent": "true"
}
}
使用curl的请求示例:
curl -H "Content-Type: application/json" -X "POST" --data @file.json http://localhost:8983/solr/city/query