Couchbase geo spatial view is not working in Couchbase Server 4.6.2 with PHP SDK 2.3 on Centos Server 7. It gives empty response.
My this code is working fine with Couchbase Server 4.5 and PHP SDK 2.2, But when I upgrade my couchbase server and php sdk it is stop working. I also checked the documentation for any new changes, but according to documentation my code is right.
My Code :
$BBoxString = $minlat.",".$minlong.",".$maxlat.",".$maxlong;
$Cluster = new CouchbaseCluster('couchbase://localhost');
$cb = $HSCluster->openBucket('bucketname', 'password');
$query = CouchbaseViewQuery::fromSpatial("geo", "geo")->limit(10)->bbox(array($BBoxString));
$results = $cb->query($query);
My View :
function (doc) {
if(doc.type=='mytype'){
if (doc.geometry) { emit(doc.geometry,null); }
}
}
View Response :
{"total_rows":0,"rows":[
{"id":"4486855365","key":[[28.50961,28.50961],[77.296668,77.296668]],"value":null},
{"id":"4118330647","key":[[28.5088051,28.5088051],[77.2987844,77.2987844]],"value":null},
{"id":"3807877765","key":[[28.5094946,28.5094946],[77.2968221,77.2968221]],"value":null},
{"id":"3662199694","key":[[28.5097386,28.5097386],[77.2970581,77.2970581]],"value":null},
{"id":"0163293645","key":[[28.5094315,28.5094315],[77.2966856,77.2966856]],"value":null},
{"id":"0065902102","key":[[28.5094946,28.5094946],[77.2968221,77.2968221]],"value":null}
]
}