Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# RavenDB空间搜索空间代数生成IgnoredLuceField_C#_Ravendb_Spatial_Spatial Index - Fatal编程技术网

C# RavenDB空间搜索空间代数生成IgnoredLuceField

C# RavenDB空间搜索空间代数生成IgnoredLuceField,c#,ravendb,spatial,spatial-index,C#,Ravendb,Spatial,Spatial Index,生成空间索引时遇到问题 我想从给定位置获取最近的事件 当我查询我的坐标时,它的值是IgnoredLuceField,我想它们的意思是LuceneField,但它说的是Luceue,所以这不是我的错别字 我有以下索引 public class ClosestEvent : AbstractIndexCreationTask<Event,ClosestEvent.ReduceResult> { public ClosestEvent() { Map =

生成空间索引时遇到问题

我想从给定位置获取最近的事件

当我查询我的坐标时,它的值是IgnoredLuceField,我想它们的意思是LuceneField,但它说的是Luceue,所以这不是我的错别字

我有以下索引

 public class ClosestEvent : AbstractIndexCreationTask<Event,ClosestEvent.ReduceResult>
{
    public ClosestEvent()
    {
        Map = events=> from myEvent in events
            select new
            {
                Id = myEvent .Id.ToString(),
                Coordinates = SpatialGenerate("Coordinates",myEvent.eventLocation.Latitude, myEvent.eventLocation.Longitude)

            };
        Reduce = results => from result in results
                            group result by result.Id
                                into g
                                select new ReduceResult
                                {
                                   Coordinates = g.Select(x=>x.Coordinates).First(),
                                    Id = g.Key
                                };
    }

    public class ReduceResult
    {
        public string Id { get; set; }
        public object Coordinates { get; set; }
    }
}
公共类ClosestEvent:AbstractIndexCreationTask
{
公共关系
{
Map=events=>来自事件中的myEvent
选择新的
{
Id=myEvent.Id.ToString(),
坐标=SpatialGenerate(“坐标”,myEvent.eventLocation.Latitude,myEvent.eventLocation.Longitude)
};
Reduce=results=>from result in results
按result.Id对结果进行分组
进入g
选择new ReduceResult
{
坐标=g.Select(x=>x.Coordinates).First(),
Id=g.键
};
}
公共类ReduceResult
{
公共字符串Id{get;set;}
公共对象坐标{get;set;}
}
}
我对此有以下疑问:

       public ClosestEvent.ReduceResult GetClosestEvent(GeolocationFilter filter)
    {

        using (var session = Store.OpenSession())
        {
            var query = session.Query<ClosestEvent.ReduceResult, ClosestEvent>().Customize(x => x.SortByDistance(
                lat: filter.lat,
                lng: filter.lng,
                fieldName: "Coordinates"
                )).Take(1).ToList();

            return query.First();

        }
    }
public ClosestEvent.ReduceResult GetClosestEvent(地理位置过滤器)
{
使用(var session=Store.OpenSession())
{
var query=session.query().Customize(x=>x.SortByDistance(
lat:filter.lat,
lng:filter.lng,
字段名:“坐标”
)).Take(1.ToList();
返回query.First();
}
}
这将返回:

Id:作为字符串的Guid

坐标:“IgnoredLuceField”


附加信息:我的数据库由ravenHQ托管

这是我的索引和查询

 Map = docs =>
                from doc in docs
                select new
                {
                    doc.Id,                   
                    _ = SpatialIndex.Generate(doc.Latitude, doc.Longitude)
                };

  var results = session
                    .Advanced
                    .LuceneQuery<Class>("IndexName")
                    .WithinRadiusOf(query.SearchRadius, query.Latitude, query.Longitude, SpatialUnits.Miles)                        
                    .SortByDistance()
Map=docs=>
从文档中的文档
选择新的
{
文件Id,
_=SpatialIndex.Generate(文档纬度、文档经度)
};
var结果=会话
先进的
.LuceneQuery(“IndexName”)
.within半径(query.SearchRadius、query.Latitude、query.Longitude、spacealUnits.Miles)
.SortByDistance()