NSFetchedResultsController with custom NSSortDescriptor

2009-08-19 Thread Sebastian Celis
Hello, I am using an NSFetchedResultsCountroller to execute a query against a Core Data database backed by a sqlite data store. I would like to sort the results by an NSString property of my NSManagedObject. However, if the property is nil or an empty string, I would like those results to appear

Re: NSFetchedResultsController with custom NSSortDescriptor

2009-08-19 Thread Kyle Sluder
You're going to need to do an in-memory sort of these objects. Your suspicions about Core Data sorting are correct: when using the SQLite store, it sends the sorting off to the database backend, where it's far more efficient to do. Have you thought instead of sorting on a dependent property of

Re: NSFetchedResultsController with custom NSSortDescriptor

2009-08-19 Thread Sebastian Celis
Well, I sort dynamically on different properties so an explicit sortIndex wouldn't be ideal. But the lack of normalization just might work. I could create a boolean field which basically acts as 'hasProperty'. I can then hook into -willSave of the NSManagedObject to set that to YES or NO