Exemple #1
0
        public async Task <object> NearAsync(NearRequest request)
        {
            BO2 bo2 = await this.GetBOAsync(request.BOT, request.BO);

            if (bo2 == null)
            {
                return(null);
            }
            FilterRequest filterRequest = new FilterRequest();

            filterRequest.Query  = JObject.Parse($"{{bot:'{bo2.BOT}',bo:{{$ne:'{request.BO}'}},location:{{$near:{{$geometry:{bo2.Location.ToJson()},$maxDistance:{request.Distince}}}}}}}");
            filterRequest.Fields = JObject.Parse("{bo:1}");
            filterRequest.Limit  = request.Top;
            List <BO2> nearestBOList = await this.FilterBOsAsync(filterRequest);

            return((nearestBOList == null || nearestBOList.Count == 0)
                ? null : nearestBOList.Select(bo => bo.BO).ToList());
        }
 public async Task <object> Near(NearRequest request)
 {
     return(await ServiceImpl.NearAsync(request));
 }
Exemple #3
0
 public async Task <object> NearAsyncInternal(HttpClientWrapper client, NearRequest request)
 {
     return(await client.PostObjectAsync(GetActionUrl(nameof(Near)), request).ConfigureAwait(false));
 }
Exemple #4
0
        public async Task <object> NearAsync(NearRequest request)
        {
            var client = InitHttpClient();

            return(await NearAsyncInternal(client, request).ConfigureAwait(false));
        }
Exemple #5
0
        public object Near(NearRequest request)
        {
            var client = InitHttpClient();

            return(Task.Run(() => NearAsyncInternal(client, request)).Result);
        }
Exemple #6
0
        public List <T> Near <T>(NearRequest request)
        {
            var list = Near(request);

            return(ToGenericList <T>(list));
        }
Exemple #7
0
        public List <Document> Near(NearRequest request)
        {
            var list = _protocol.Near(request);

            return(list.Cast <Document>().ToList());
        }
Exemple #8
0
 public object Near(NearRequest request)
 {
     return(Task.Run(() => NearAsync(request)).Result);
 }