• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Predicate search across Core Data entities.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Predicate search across Core Data entities.


  • Subject: Re: Predicate search across Core Data entities.
  • From: Mark Woollard <email@hidden>
  • Date: Thu, 02 Feb 2012 07:37:32 +0000

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 (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

_______________________________________________

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


References: 
 >Predicate search across Core Data entities. (From: David Delmonte <email@hidden>)

  • Prev by Date: RE: Selected text in NSTextField
  • Next by Date: Re: Selected text in NSTextField
  • Previous by thread: Predicate search across Core Data entities.
  • Next by thread: Re: iCloud On OSX - Cannot save changes (Resolved?)
  • Index(es):
    • Date
    • Thread