The CBLIncrementalStore analyses the NSPredicate used in a fetchRequest and, like Jens said, tries to use views as much as possible, before analyzing the data itself.
Not all expression types are supported as some are rather special. I used it in a complex project (my vocabulary trainer) for a test and all worked well... so I think most use cases should be covered. The SQLite persistent storage does the same and creates SQL selects, just as we use the views. This is an area where performance is key. Maybe somebody with a deeper CouchbaseLite knowledge could improve it further? On Thursday, April 10, 2014 4:12:14 PM UTC+2, Jens Alfke wrote: > > > On Apr 10, 2014, at 5:45 AM, Ragu Vijaykumar <[email protected]<javascript:>> > wrote: > > I was wondering how fetchs work when using the CBLIncremental store. > Aren't the NSPredicates written via SQL logic? Is there any specific way we > should write filters in NSPredicate for NSFetchRequests for use with the > CBL backend? Thanks for your help! > > > I haven’t used that class, and I’ve only looked through the source code > once, but I remember that it only implements a subset of the full > functionality of NSPredicate. You might want to look at the source; it’s in > one file and the sections are pretty clearly grouped using “#pragma mark” > lines. The sections on “NSPredicate”, “Querying” and “Views” are especially > interesting. > > Looks like one of the limits is that it only supports NSExpression types > NSConstantValueExpressionType, NSEvaluatedObjectExpressionType, > NSKeyPathExpressionType, > with a comment: > // not supported yet: > // NSFunctionExpressionType, > // NSAggregateExpressionType, > // NSSubqueryExpressionType = 13, > // NSUnionSetExpressionType, > // NSIntersectSetExpressionType, > // NSMinusSetExpressionType, > // NSBlockExpressionType = 19 > > It will automatically generate views for querying a specific property of a > specific entity type. I think what happens is that it uses the view for > basic filtering, and then any further processing in an NSFetchExpression > happens at runtime by testing every matching doc against the predicate and > then evaluating the expression. > > Hopefully the author (Christian Beer) is reading this and can give more > insight :) > > —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/370bee51-3d9c-4182-a35e-1186d6438673%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
