搜索索引器无法检索从DocumentDB中的文档归档的Geogr

搜索索引器无法检索从DocumentDB中的文档归档的Geogr

本文介绍了Azure搜索索引器无法检索从DocumentDB中的文档归档的GeographyPoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试索引存储在DocumentDb集合中的文档时遇到问题.

I'm having an issue while trying to index a document stored in a DocumentDb collection.

使用自定义SQL定义了索引器的数据源,以检索更改的文档.我要索引的文档具有名为 LocationGP 的属性,该属性是Microsoft.Spatial.GeographyPoint,并映射到具有相同名称并定义为 DataType.GeographyPoint

The datasource of the indexer was defined with a custom SQL to retrieve the changed documents. The document I want to index has a property called LocationGP which is a Microsoft.Spatial.GeographyPoint, and is mapped to a field of the index with the same name and defined as DataType.GeographyPoint

尝试创建索引器时遇到的错误是:

The error I get when trying to create the indexer is:

列"LocationGP"的类型为JObject,与索引中Edm.GeographyPoint类型的字段不兼容

有什么想法吗?

这是数据源的定义:

  return new DataSource()
                {
                    Name = "opportunities-datasource",
                    Container = new DataContainer()
                    {
                        Name = "Companies",
                        Query = @"SELECT    o.id,
                                            o.CompanyName,
                                            o.LocationGP,
                                            o.Location.CityName AS LocationCity,
                                            o.Location.StateName AS LocationState,
                                            o.Location.CountryName AS LocationCountry,
                                            o._ts
                                FROM Companies o WHERE o.DocType = 1 AND o._ts > @HighWaterMark"
                    },
                    Type = "documentdb",
                    Credentials = new DataSourceCredentials()
                    {
                        ConnectionString = String.Format("AccountEndpoint={0};AccountKey={1};Database=CompaniesDb", DocumentDbEndpointUri, DocumentDbPrimaryKey)
                    },
                    DataChangeDetectionPolicy = new HighWaterMarkChangeDetectionPolicy("_ts"),
                    DataDeletionDetectionPolicy = new SoftDeleteColumnDeletionDetectionPolicy("Status", "2")
                };

这是文档:

[{
    "id": "088e1e97-6d59-40ad-a9be-620fdc7938c7",
    "CompanyName": "Neptune",
    "LocationGP": {
      "Latitude": 39.8010482788086,
      "Longitude": -89.6436004638672,
      "IsEmpty": false,
      "Z": null,
      "M": null,
      "CoordinateSystem": {
        "EpsgId": 4326,
        "Id": "4326",
        "Name": "WGS84"
      }
    },
    "Location": {
      "CityName": "Springfield",
      "CountryName": "US",
      "StateName": "IL"
    },
    "Status": 1,
    "DocType": 1,
    "Timestamp": "2016-08-19T16:08:46.0481948Z",
    "_ts": 1471622922
  }]

推荐答案

Azure Search上还有另外两个文档,它们说明了可接受的地理实例类型:

Here are two more documents on Azure Search that explains what type of geography instances are accepted:

基本上,它必须是GeoJSON"Point"类型的格式.

Basically it needs to be in GeoJSON "Point" type format.

这篇关于Azure搜索索引器无法检索从DocumentDB中的文档归档的GeographyPoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:47