【问题标题】:How Can I search document of cloudant geospacial index with cloudant-client如何使用 cloudant-client 搜索 cloudant 地理空间索引的文档
【发布时间】:2018-04-16 15:09:33
【问题描述】:

我正在尝试使用 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);
  }
}

我正在尝试搜索以下文档。但我得到错误:

异常消息: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。 错误:未找到。原因:_geo 未找到..

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);

【问题讨论】:

    标签: java geospatial cloudant


    【解决方案1】:

    查看有关地理空间查询的 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

    【讨论】:

      猜你喜欢
      • 2015-04-26
      • 1970-01-01
      • 2013-10-12
      • 1970-01-01
      • 2022-11-02
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 2016-08-06
      相关资源
      最近更新 更多