コード例 #1
0
ファイル: CloudSearch.cs プロジェクト: enshivam/.net-sdk
        public void Near(string columnName, CloudGeoPoint geoPoint, double distance)
        {
            var obj = new Dictionary <string, Object>();

            obj["geo_distance"] = new Dictionary <string, Object>();
            ((Dictionary <string, Object>)obj["geo_distance"])["distance"]   = distance;
            ((Dictionary <string, Object>)obj["geo_distance"])["columnName"] = geoPoint.dictionary["coordinates"];

            this._PushInMustFilter(obj);
        }
コード例 #2
0
ファイル: CloudQuery.cs プロジェクト: enshivam/.net-sdk
        public CloudQuery GeoWithin(string columnName, CloudGeoPoint geoPoint, double radius)
        {
            double[] coordinates = (double[])geoPoint.dictionary["coordinates"];

            if (((Dictionary <string, Object>)(this.dictionary["query"]))[columnName] == null)
            {
                ((Dictionary <string, Object>)(this.dictionary["query"]))[columnName] = new Dictionary <string, Object>();
                Dictionary <string, object> geoWithin    = new Dictionary <string, object>();
                Dictionary <string, object> centerSphere = new Dictionary <string, object>();
                centerSphere.Add("coordinates", coordinates);
                centerSphere.Add("radius", radius / 3963.2);
                geoWithin.Add("$geometry", centerSphere);
                ((Dictionary <string, Object>)(((Dictionary <string, Object>)(this.dictionary["query"]))[columnName]))["$geoWithin"] = geoWithin;
            }

            return(this);
        }