Errors when using 2.1.3 SDK for spatial views in box selection

When querying through java sdk with the following query:

SpatialViewQuery query = SpatialViewQuery.from("all", "by_coords").range(
                JsonArray.empty().add(x).add(y),
                JsonArray.empty().add(x + range).add(y + range))
                .stale(Stale.TRUE)
                .limit(10)
                ;

According to tcpdump, the sdk queries this URL:

host:8092/osm/_design/all/_spatial/by_coords?limit=10&stale=ok&start_range=[776000,5102000]&end_range=[777000,5103000]

instead of:

host:8092/osm/_design/all/_spatial/by_coords?bbox=270000%2C5100000%2C780000%2C5140000&stale=ok&connection_timeout=60000000&limit=10

Am I the only one ?

EDIT: do not pay attention to url encoding, the error is coming from the start/end ranges instead of bbox :slight_smile:

So, I’ve been checking the sources about that and noticed that it has just not been implemented, so I did it and create a pull request:

Pull request

@cambierr the title says errors: which errors are you getting exactly?

Also, would it be possible to show both queries with the same location? We need to verify the equivalent: bbox=a,b,c,d <=> start_range=[a,b]&end_range=[c,d]

I also tried with same settings and they match.

The response from the BBox request is the one we are waiting for.

For the request as sent by the sdk, CB 3.x.x closes the connexion without sending any response.

@cambierr can you share TRACE level logging on the client of that interaction? The server closing the connection doesn’t sound right, in general it would reject the request with something like an invalid request or so.

@cambierr Which version of Couchbase are you using? When you use several nodes, it’s a know issue that spatial views are broken in Couchbase >= 3.0.2. It will be fixed in 3.1.0.

@vmx: 3.0.3 1716 on single node.

@daschl: here is something ineresting, then the complete output:

         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 48 54 54 50 2f 31 2e 31 20 35 30 30 20 49 6e 74 |HTTP/1.1 500 Int|
|00000010| 65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 |ernal Server Err|
|00000020| 6f 72 0d 0a 53 65 72 76 65 72 3a 20 4d 6f 63 68 |or..Server: Moch|
|00000030| 69 57 65 62 2f 31 2e 30 20 28 41 6e 79 20 6f 66 |iWeb/1.0 (Any of|
|00000040| 20 79 6f 75 20 71 75 61 69 64 73 20 67 6f 74 20 | you quaids got |
|00000050| 61 20 73 6d 69 6e 74 3f 29 0d 0a 44 61 74 65 3a |a smint?)..Date:|
|00000060| 20 54 68 75 2c 20 30 32 20 4a 75 6c 20 32 30 31 | Thu, 02 Jul 201|
|00000070| 35 20 31 31 3a 35 35 3a 31 30 20 47 4d 54 0d 0a |5 11:55:10 GMT..|
|00000080| 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 |Content-Type: te|
|00000090| 78 74 2f 70 6c 61 69 6e 3b 63 68 61 72 73 65 74 |xt/plain;charset|
|000000a0| 3d 75 74 66 2d 38 0d 0a 43 6f 6e 74 65 6e 74 2d |=utf-8..Content-|
|000000b0| 4c 65 6e 67 74 68 3a 20 35 33 0d 0a 43 61 63 68 |Length: 53..Cach|
|000000c0| 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6d 75 73 74 2d |e-Control: must-|
|000000d0| 72 65 76 61 6c 69 64 61 74 65 0d 0a 0d 0a 7b 22 |revalidate....{"|
|000000e0| 65 72 72 6f 72 22 3a 22 75 6e 6b 6e 6f 77 6e 5f |error":"unknown_|
|000000f0| 65 72 72 6f 72 22 2c 22 72 65 61 73 6f 6e 22 3a |error","reason":|
|00000100| 22 66 75 6e 63 74 69 6f 6e 5f 63 6c 61 75 73 65 |"function_clause|
|00000110| 22 7d 0a                                        |"}.             |
+--------+-------------------------------------------------+----------------+ 

But working perfectly with bbox

http://pastebin.com/nG7LmYgT

@cambierr: As spatial view are broken on 3.0.3 I strongly suggest to use 4.0 beta instead.

Other than that, would it be possible to do the requests from the command line via curl? That would make it easy for me to reproduce it.

Right, this now looks more like a server than a client issue. Can you, as @vmx suggested, try 4.0 beta and see if it works? If it doesn’t can you please raise a ticket here: http://www.couchbase.com/issues/browse/MB

@vmx, here is a curl line; i openned firewall & bucket protection:

curl --globoff 'http://167.114.234.102:8092/osm/_design/all/_spatial/by_coords?limit=10&stale=false&start_range=[-10000000,-10000000]&end_range=[10000000,10000000]'

I noticed something strange, with short ranges, curl works while the SDK is blocking… I’ll do some more testing and I’ll be back with more informations

Here is a sample that does not works (short ranges) :

curl --globoff 'http://167.114.234.102:8092/osm/_design/all/_spatial/by_coords?limit=10&stale=false&start_range=[-844797,3868150]&end_range=[-844795,9868152]'

@cambierr: Does that one even not work with curl? And what does “not work” mean? blocking?