I’m trying to use simple like query in N1QL but I get java.io.FileNotFoundException
heres my HttpsRequest http://localhost:8093/query/service?statement=SELECT%20meta(c).id,c.*,s.userName,s.type,s.profilePic%20FROM%20Community%20c%20INNER%20JOIN%20staging%20s%20ON%20c.stagingId%20=%20meta(s).id%20WHERE%20c.notes%20LIKE%20'%xmas%'%20ORDER%20BY%20c.uploadDate%20DESC
. When I try it in Postman same request its working, why is it throwing an exception in android?
Seems like this post is tagged wrong, could you use N1QL
, query
instead of mobile
, CouchbaseLite
.
I moved it to the N1QL category
Exception is from android, N1QL will not give Java error.
The problem might be:
The ‘%’ is escape character in the URI. When using % as wild card in N1QL URI format query, you need to escape that by replacing it with corresponding ascii code. example wildcard ‘%’ with ‘%25’
OR
You can use JSON formatted query
http://localhost:8093/query/service -H "Content-Type: application/json" -d '{"statement": "SELECT meta(c).id,c.*,s.userName,s.type,s.profilePic FROM Community c INNER JOIN staging s ON c.stagingId = meta(s).id WHERE c.notes LIKE \"%xmas%\" ORDER BY c.uploadDate DESC"}'
http://localhost:8093/query/service?statement=SELECT%20meta(c).id,c.*,s.userName,s.type,s.profilePic%20FROM%20Community%20c%20INNER%20JOIN%20staging%20s%20ON%20c.stagingId%20=%20meta(s).id%20WHERE%20c.notes%20LIKE%20'%25xmas%25'%20ORDER%20BY%20c.uploadDate%20DESC
Thank you for these. Using the right character did it, my first try was %20.