gpt4 book ai didi

c# - RavenDB 空间搜索始终为空

转载 作者:行者123 更新时间:2023-11-30 22:55:42 24 4
gpt4 key购买 nike

我试图根据纬度和经度查找文档,所以我得到了这个:

应该找到已存储的示例文档:

{
"UID": "uIwHCBvvAJ",
"Description": "galletita",
"Created": "03/01/2019 08:40:18",
"Active": true,
"Point": {
"latitude": -37.7505796,
"longitude": -57.4275142,
"distanceFromMe": 0
},
"Shape": {
"s": null,
"Longitude": null
}
}

现在这是索引、类和查询:

public class Test_Spatial40 : AbstractIndexCreationTask<Test>
{
public Test_Spatial40()
{
Map = docs => from spatial in docs
select new
{
Shape = spatial.Shape,
Point = spatial.Point,
_ = SpatialGenerate("Coordinates", spatial.Point.latitude, spatial.Point.longitude),
_2 = SpatialClustering("Clustering", spatial.Point.latitude, spatial.Point.longitude)
};

Spatial(x => x.Shape, options => options.Geography.Default());
Spatial(x => x.Point, options => options.Cartesian.BoundingBoxIndex());
}
}

List<Test> r = session
.Query<Test, Test_Spatial40>()
.Customize(x => x.SortByDistance())
.Spatial(
x => x.Shape,
criteria => criteria
.WithinRadius((int)maxDist, (double)la, (double)lo))
.ToList();

from spatial in docs
select new
{
Shape = spatial.Shape,
Point = spatial.Point,
_ = SpatialGenerate("Coordinates", spatial.Point.latitude, spatial.Point.longitude),
_2 = SpatialClustering("Clustering", spatial.Point.latitude, spatial.Point.longitude)
};

Spatial(x => x.Shape, options => options.Geography.Default());
Spatial(x => x.Point, options => options.Cartesian.BoundingBoxIndex());

它应该将相同的纬度和经度传递给查询它应该返回结果,但每次都是空的......有什么想法吗?

最佳答案

为了查询它,您需要在“形状”字段中包含“纬度”和“经度”。(如果要按Shape查询)。

关于c# - RavenDB 空间搜索始终为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55049084/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com