-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSFNanoSearch should filter objects of a specific class #27
Comments
Just to make sure I understand what you need, could you please give me a use case? For example, do you want to obtain just the count, or search a series of objects with a given criteria that match a specific object class? |
I would like to search a series of objects with a given criteria that match a specific object class. A use case I consider is I have subclasses of NSFNanoObject, say "Car" or "People", both have key "name" and "age". If I do a search on age, the returned class may contains Car or People, which is not what I expected. Am I using it wrong? |
No, you're not doing it wrong. The NSFObjectClass class attribute is not exposed via the API, so there's no way right now to discriminate results based on object type. Good suggestion though. I'll use this bug as an enhancement request. |
Cool, thanks! |
Changed the title of this issue from: Can I use NSFNanoSearch to search objects a specific class? to: NSFNanoSearch should filter objects of a specific class |
Cool, will try it out now! |
Yes please, report back when you have a chance. Thanks! |
The filtering work on using attribute/match/value on NSFNanoSearch, but not when i supply expressions. working on it and will send a pull request. |
Furthermore, the filtering only apply when search is NSFReturnObjects. Is it feasible for it to work when I search with NSFReturnKeys? It is helpful if i want to delete all objects of a specific type on some conditions. |
Yes, it is feasible. It definitely should work. I have opened a new issue to track the changes: #29 |
In NSFNanoStore, i can count objects of specific class by -objectsOfClassNamed: method. Can i do similar search using NSFNanoSearch?
Can i set NSFObjectClass in NSFNanoSearch/Predicate/Expression?
The text was updated successfully, but these errors were encountered: