tciuro / NanoStore

NanoStore is an open source, lightweight schema-less local key-value document store written in Objective-C for Mac OS X and iOS.
Other
404 stars 39 forks source link

Use limit and filterClass in the same NSFNanoSearch does not work #88

Closed ohdonpiano closed 11 years ago

ohdonpiano commented 11 years ago

Hi,

I've recently found out that if "limit" and "filterClass" are used within the same PPNanoSearch basic query, to achieve a limited set of PPNanoObjects of particular class type, the filterClass is not used.

Reporting the queries below:

With filterClass, without limit:

SELECT NSFKey, NSFKeyedArchive, NSFObjectClass FROM NSFKeys WHERE NSFObjectClass = "Profile"

With filterClass and limit:

SELECT NSFKey, NSFKeyedArchive, NSFObjectClass FROM NSFKeys LIMIT 10

loosing the WHERE clause, the query does return objects of any kind.

ohdonpiano commented 11 years ago

In addition, a sample code from my project:

NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];

NSFNanoSortDescriptor *sortByDate = [[NSFNanoSortDescriptor alloc] initWithAttribute:@"date" ascending:NO]; search.sort = [NSArray arrayWithObject:sortByDate]; search.limit = 10; search.offset = 0;

search.filterClass = @"Profile";

NSError *error = nil; result = [search searchObjectsWithReturnType:NSFReturnObjects error:&error];

tciuro commented 11 years ago

Thanks Daniele!

ohdonpiano commented 11 years ago

Many thanks to you for the project and the quick fix !!!