FYI I remembered when debugging this that when you want to see what your 
filter parameters are, a line like this 

function(doc, req) {

  throw JSON.stringify(req);

}

will make them show up in the Xcode logs. In the case of the first code I 
tested, anything but numbers and true or "false" would fail to parse as a 
parameter. Now it works great, but you may have to decodeURIComponent and 
JSON.parse parameters in your filter function (or switch to a comma 
separated list or something easier to decode.)

Chris



On Wednesday, August 13, 2014 12:36:10 PM UTC-7, J. Chris Anderson wrote:
>
> It looks like this is an area with a recent change, making clear that 
> parameters are not to be parsed as JSON:
>
>
> https://github.com/couchbase/couchbase-lite-ios/commit/8bf60318ec828d8172a6dfc6275663505b57bf60
>
> It may be that the plugin version you've got still tries to parse the 
> parameters as JSON but in the future it won't.
>
> Here's a hand-built PhoneGap plugin for now (with some extra logging if 
> you enable -LogCBL_Router YES) 
> https://dl.dropboxusercontent.com/u/14074521/com.couchbase.lite.phonegap.zip
>
> These fixes will be in the next release.
>
> Chris
>
> On Tuesday, August 12, 2014 1:02:15 PM UTC-7, J. Chris Anderson wrote:
>>
>> Just to let you know I'm looking into this and the filter compilation 
>> seems to be running fine. It *looks* like the problem is in JSON parameter 
>> handling. So it will take more investigation but now I know where to look.
>>
>> Chris
>>
>> On Monday, August 4, 2014 2:16:00 PM UTC-7, Seung Chan Lim wrote:
>>>
>>> Sorry, I can't share the app. :( I'll be more than happy to help in 
>>> others possible ways as needed.
>>>
>>> slim
>>>
>>> On Monday, August 4, 2014 1:08:42 PM UTC-4, J. Chris Anderson wrote:
>>>>
>>>>
>>>>
>>>> On Sunday, August 3, 2014 2:00:04 PM UTC-7, Seung Chan Lim wrote:
>>>>>
>>>>> Yeah, I just tried a filter that returns true no matter what, and 
>>>>> still doesn't work.
>>>>>
>>>>> I get a change notify from the http socket that does not utilizes the 
>>>>> filter, but none from the one that does.
>>>>>
>>>>>
>>>> Any chance you can share (privately is ok) your app so I can try to 
>>>> reproduce? Otherwise I'll start an independent repro.
>>>>
>>>> Thanks,
>>>> Chris
>>>>  
>>>>
>>>>> slim
>>>>>
>>>>> On Sunday, August 3, 2014 1:21:24 PM UTC-4, J. Chris Anderson wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Saturday, August 2, 2014 8:37:58 PM UTC-7, Seung Chan Lim wrote:
>>>>>>>
>>>>>>> Thanks Chris.
>>>>>>>
>>>>>>> I'm testing it out. I'm using the main GIT repository URL I've been 
>>>>>>> using since it seems to be up-to-date. If that assumption is incorrect, 
>>>>>>> please let me know.
>>>>>>>
>>>>>>> What I'm seeing is that I no longer get a 404. But I'm not getting 
>>>>>>> any change notifications, either.
>>>>>>>
>>>>>>>
>>>>>> If you write a function that passes everything does it work? I guess 
>>>>>> my first debug pass would be to ensure that the JS is getting called and 
>>>>>> runs on an always true filter.
>>>>>>
>>>>>> If that works then it's just a matter of debugging your JS until you 
>>>>>> get the results you need. If even an always true filter doesn't work, 
>>>>>> then 
>>>>>> we need to debug the rest of the code path, so we'll probably end up 
>>>>>> opening a ticket with whatever you find there.
>>>>>>
>>>>>> Chris
>>>>>>  
>>>>>>
>>>>>>> This is what I have in my design document (id is _design/utils)
>>>>>>>
>>>>>>>
>>>>>>> filters: {
>>>>>>>        by_id: (function(doc, req) { 
>>>>>>>    if (req.query.doc_ids.indexOf(doc._id) != -1) { 
>>>>>>>
>>>>>>>        return true;
>>>>>>>    } else {
>>>>>>>        return false;
>>>>>>>
>>>>>>>    } 
>>>>>>>        }).toString()
>>>>>>>    }
>>>>>>>
>>>>>>> The request URL looks like this
>>>>>>>
>>>>>>>
>>>>>>> http://lite.couchbase./status32/_changes?feed=continuous&include_docs=true&filter=utils/by_id&doc_ids=%5B%22MY_ID%22%5D
>>>>>>>
>>>>>>> Can you see if I'm doing something obviously wrong?
>>>>>>>
>>>>>>>
>>>>>>> slim
>>>>>>>
>>>>>>> On Friday, August 1, 2014 3:13:11 PM UTC-4, J. Chris Anderson wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wednesday, July 30, 2014 6:42:53 PM UTC-7, J. Chris Anderson 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wednesday, July 30, 2014 6:40:31 PM UTC-7, J. Chris Anderson 
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Eagerly awaiting Chris to rebuild the phone gap plugin. 
>>>>>>>>>>>
>>>>>>>>>>> How do I know when this gets done?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>> Here is a 1.0.2 RC build for the phonegap plugin 
>>>>>>>> <http://cbfs-ext.hq.couchbase.com/builds/Couchbase-Lite-PhoneGap-Plugin_1.0.2-35.zip>
>>>>>>>>  that 
>>>>>>>> includes Jens patch 
>>>>>>>> <https://github.com/couchbaselabs/couchbase-lite-phonegap-plugin-builder/commit/844c64eb5459ee3e48921f9727aa26bba8565663>.
>>>>>>>>  
>>>>>>>> You can download and unzip it, and then use the full path to the 
>>>>>>>> unzipped 
>>>>>>>> directory, instead of a git URL for the PhoneGap plugin installer.
>>>>>>>>
>>>>>>>> I'll verify it after lunch but I'm 99% sure it is great so give it 
>>>>>>>> a try. Once it passes verification here I'll update the git and 
>>>>>>>> cordova 
>>>>>>>> repos. Let me know how that goes.
>>>>>>>>
>>>>>>>> Chris
>>>>>>>>
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>> On my plate for this week is to cut a 1.0.1 release of PhoneGap (I 
>>>>>>>>>> don't think this will have your fixes, but as soon as I have 1.0.1 
>>>>>>>>>> done 
>>>>>>>>>> I'll start work on 1.1) 1.1 will include the filter stuff. It will 
>>>>>>>>>> also 
>>>>>>>>>> drop support for iOS 6. (Although we could maintain a parallel 
>>>>>>>>>> version that 
>>>>>>>>>> supports iOS 6 if there is strong demand.)
>>>>>>>>>>
>>>>>>>>>> So my guess is that we'll have something you can play with early 
>>>>>>>>>> next week. Here's the bug to follow / ping me on if it takes longer 
>>>>>>>>>> than a 
>>>>>>>>>> week.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> Sent too early. Here is the link 
>>>>>>>>> <https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin/pull/32>.
>>>>>>>>>  
>>>>>>>>> You could also try applying this locally. (In every copy of 
>>>>>>>>> CBLite.m you can find!) 
>>>>>>>>> <https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin/commit/b51888908204ec3306697a20e48414cf20183176>
>>>>>>>>>  
>>>>>>>>>  
>>>>>>>>>
>>>>>>>>>> Chris
>>>>>>>>>>
>>>>>>>>>> Chris
>>>>>>>>>>  
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> slim
>>>>>>>>>>>
>>>>>>>>>>> On Tuesday, July 29, 2014 7:30:06 PM UTC-4, Jens Alfke wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Jul 29, 2014, at 4:14 PM, Jens Alfke <[email protected]> 
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> I just took a minute to debug this. The answer is simply that 
>>>>>>>>>>>> there isn't any support (yet) for JavaScript-based filters. The 
>>>>>>>>>>>> JavaScriptCore integration only supports views (map and reduce 
>>>>>>>>>>>> functions) 
>>>>>>>>>>>> so far.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Oops, not true, Should have looked at the source more closely. 
>>>>>>>>>>>> JS filters *are* already implemented, it’s just that the 
>>>>>>>>>>>> top-level function that registers JS compilers only registers the 
>>>>>>>>>>>> view 
>>>>>>>>>>>> compiler, not the filter compiler. This just took a couple of 
>>>>>>>>>>>> lines to fix, 
>>>>>>>>>>>> so I’ve checked it in (commit 812cf64.)
>>>>>>>>>>>>
>>>>>>>>>>>> However, the PhoneGap container/plugin will have to be rebuilt 
>>>>>>>>>>>> (with this commit) before PhoneGap apps can use this. I don’t know 
>>>>>>>>>>>> how to 
>>>>>>>>>>>> do that, but Chris does…
>>>>>>>>>>>>
>>>>>>>>>>>> —Jens
>>>>>>>>>>>>
>>>>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/8080d3d9-f6fc-4b7d-b1c7-910366f18121%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to