Skip to content
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

Closed
siuying opened this issue May 23, 2012 · 10 comments
Closed

NSFNanoSearch should filter objects of a specific class #27

siuying opened this issue May 23, 2012 · 10 comments
Assignees

Comments

@siuying
Copy link
Contributor

siuying commented May 23, 2012

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?

@tciuro
Copy link
Owner

tciuro commented May 23, 2012

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?

@siuying
Copy link
Contributor Author

siuying commented May 23, 2012

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?

@tciuro
Copy link
Owner

tciuro commented May 23, 2012

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.

@siuying
Copy link
Contributor Author

siuying commented May 23, 2012

Cool, thanks!

@ghost ghost assigned tciuro May 26, 2012
@tciuro
Copy link
Owner

tciuro commented May 26, 2012

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

@tciuro tciuro closed this as completed in 9ea7a1a May 26, 2012
@siuying
Copy link
Contributor Author

siuying commented May 27, 2012

Cool, will try it out now!

@tciuro
Copy link
Owner

tciuro commented May 27, 2012

Yes please, report back when you have a chance. Thanks!

@siuying
Copy link
Contributor Author

siuying commented May 28, 2012

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.

@siuying
Copy link
Contributor Author

siuying commented May 28, 2012

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.

@tciuro
Copy link
Owner

tciuro commented May 28, 2012

Yes, it is feasible. It definitely should work.

I have opened a new issue to track the changes: #29

@tciuro tciuro closed this as completed May 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants