如何使用 cloudant-client 搜索 cloudant 地理空间索引的文档
How Can I search document of cloudant geospacial index with cloudant-client
我正在尝试使用 cloudant 的地理空间索引来搜索文档。
此外,我一直在使用 cloudant java 客户端,如下所示。
但是我找不到搜索文件的方法或样本。
请帮助我!!
<dependency>
<groupId>com.cloudant</groupId>
<artifactId>cloudant-client</artifactId>
<version>2.12.0</version>
</dependency>
这是地理空间索引。
_design/eventgeo
indexname:st_index
function (doc) {
if (doc.geometry && doc.geometry.coordinates) {
st_index(doc.geometry);
}
}
我正在尝试搜索以下文档。但我得到错误:
Exception message:404 Object Not Found at
https://??????.cloudant.com:443/events/_design/eventgeo/_search/_geo?limit=10&include_docs=true&q=lat:150.78688%20and%20lon:38.67915%20and%20radius:10000%20and%20relation:contains%20and%20include_docs:true.
Error: not_found. Reason: _geo not found..
List<Event> events = this.database.search("eventgeo/_geo/st_index").limit(10).includeDocs(true)
.query("lat:" + latitude + " and lon:" + longitude + " and radius:" + 10000 + " and relation:contains"
+ " and include_docs:true", Event.class);
查看有关地理空间查询的 Cloudant 文档:
https://console.bluemix.net/docs/services/Cloudant/api/cloudant-geo.html#cloudant-nosql-db-geospatial
您似乎正在使用搜索 API 端点:
_design/eventgeo/_search/_geo
我相信您想改用地理空间索引 API 端点:
_design/eventgeo/_geo/geoidx
我正在尝试使用 cloudant 的地理空间索引来搜索文档。 此外,我一直在使用 cloudant java 客户端,如下所示。 但是我找不到搜索文件的方法或样本。 请帮助我!!
<dependency>
<groupId>com.cloudant</groupId>
<artifactId>cloudant-client</artifactId>
<version>2.12.0</version>
</dependency>
这是地理空间索引。
_design/eventgeo
indexname:st_index
function (doc) {
if (doc.geometry && doc.geometry.coordinates) {
st_index(doc.geometry);
}
}
我正在尝试搜索以下文档。但我得到错误:
Exception message:404 Object Not Found at https://??????.cloudant.com:443/events/_design/eventgeo/_search/_geo?limit=10&include_docs=true&q=lat:150.78688%20and%20lon:38.67915%20and%20radius:10000%20and%20relation:contains%20and%20include_docs:true. Error: not_found. Reason: _geo not found..
List<Event> events = this.database.search("eventgeo/_geo/st_index").limit(10).includeDocs(true)
.query("lat:" + latitude + " and lon:" + longitude + " and radius:" + 10000 + " and relation:contains"
+ " and include_docs:true", Event.class);
查看有关地理空间查询的 Cloudant 文档: https://console.bluemix.net/docs/services/Cloudant/api/cloudant-geo.html#cloudant-nosql-db-geospatial
您似乎正在使用搜索 API 端点:
_design/eventgeo/_search/_geo
我相信您想改用地理空间索引 API 端点:
_design/eventgeo/_geo/geoidx