Friday, 15 March 2013

python - Couchbase adding quotes to Spatialviewrows Value -



python - Couchbase adding quotes to Spatialviewrows Value -

i wrote geospatialview in couchbase:

function (doc, meta) { if(doc.type == 'bar') { if(doc.position) { emit( { type: "point", coordinates: [doc.position.latitude, doc.position.longitude] }, doc.companyid); } } }

i seek them via bounding box. couchbase correctly returns objects within box. want emit companyid value , compare string find out if request permitted.

the problem value emited in unicode:

u'''cm-dummycompany'''

the comparestring got cbobject this:

u'cm-dummycompany'

when compare these fails. thought how compare right way?

i tried == , is. tried cast string , compare, fails because have nonconform characters äöü

or improve question, why double quotes added emitted value?

okay, found solution in couchbase issue tracker:

spatial views homecoming value double encoded

so facing problem: issue is, in spatial views, value gets double encoded. means if homecoming number becomes string. , string becomes string escaped quotes.

actually fixed in 3.0.1 updated , problem still exists.

my workaround remove quotes via re:

value = re.sub('"','',value)

python return-value geospatial couchbase bounding-box

No comments:

Post a Comment