Re: Search on Core data Table issue?
Re: Search on Core data Table issue?
- Subject: Re: Search on Core data Table issue?
- From: mmalc Crawford <email@hidden>
- Date: Thu, 22 Oct 2009 10:40:22 -0700
On Oct 22, 2009, at 4:09 am, Matthew Lindfield Seager wrote:
> A "reducing search" is more commonly referred to as filtering. A
> google search should help you very quickly as this is very easy with
> core data & bindings.
>
The question is related to iPhone and NSFetchedRestultsController, therefore desktop bindings are irrelevant.
On Oct 20, 2009, at 10:56 pm, Damien Cooke wrote:
> One of the big problems as I see it is going to be updating the interface to let it know what to present. I assume an alternative NSFetchedResultsController needs to be sent to the UITableView.
>
No, but that points along the right lines...
> So here are my issues:
> 1) I assume I need to create a NSFetchedResultsController with only the correct items in it then tell the UITableView to use this as the dataSource and reload the table?
> 2) is there a better way than executing a full sorted fetch and removing those objects that do not conform. ie is there a way of doing a select where type fetch?
>
The fetched results controller is particularly well-suited to managing sectioned data. In a search results table, you don't have sections, and moreover your results set is pretty much guaranteed to change on every use, so incurring the overhead of storing the results is a waste.
Rather than using a fetched results controller, therefore, simply execute a standard fetch for at least the first search character, typically for subsequent characters you might do in-memory filtering of the first returned-array.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden