If I understand you correctly, you want to search for matches against 
attributes in the various objects in your model. I would move the searchable 
attributes out into their own entity 'searchableAttribute', with attributes 
'name' and 'value'. I'd then define a base entity 'searchableEntity' and setup 
a one to many relationship and its inverse between searchableEntity and 
searchableAttribute. I would then define entities that derive from 
SearchableEntity for mainEntity, personEntity etc.

You can then just search searchableAttribute and work back through the inverse 
relationship to the entity to display. 

Mark

On 1 Feb 2012, at 22:39, David Delmonte wrote:

> 
> Hello Everyone!
> 
> I am trying to understand if it's possible (and then how to do it) to employ 
> a UISearchBar to find data that cuts across core data entities.
> 
> I have a model that basically has one mainEntity, then a personEntity, 
> placeEntity, and some others.
> 
> A record in the mainEntity can have multiple people and multiple  places, so 
> there are one to many relationships between the mainEntity and each 
> "subEntity".
> 
> I can easily get the data from the mainEntity with a basic search, and -- 
> without searching,  I can display the data in the subEntities fine in a 
> tableView.
> 
> I just cannot figure how to search for a record that would include say, a 
> mainEntity item for all "Fathers" in "France".
> 
> I would prefer to write this in code hence the post to this group instead of 
> to the xCode group. However, if you advise me to post there, no worries..
> 
> 
> The main entity looks like this:
> 
> attributes:
> 
> item
> details
> date
> ....
> 
> relationships:
> 
> people
> place
> ...
> 
> 
> The people entity looks like this:
> 
> attributes:
> 
> name
> address
> ...
> 
> relationship (inverse):
> main
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/mark.woollard%40mac.com
> 
> This email sent to mark.wooll...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to