English 中文(简体)
不同主次的核心数据查询
原标题:Core Data search in different enteties

I use a search controller in my app. The user types in a word and I return a list of Core Data entities, where each has a title containing that word. That s easy.

但是,我也希望在名单上的底部归还拥有搜索词作为所有权的其他实体,它们与我首先搜索的那些实体有着接触。

因此,如果我没有在标题中找到搜索词,我想查阅与第一类实体有关的实体的名称。

是否可能有一个单一的国家安保局?

Here is my Core Data model

“Code

最佳回答

您有两类实体:Term部分。 你们希望有一个这样的清单:

  • First all the Term entities with title == title
  • Then all the Part entities with title == title

如果是正确的,你就能够用一个在名单上的两部分打上钩。 最容易的方式是执行两个单独的专栏,将第二个名单贴到第一个。 如果你在数据中增加更多结构,那么你就可以在一个ancy小的要求中完成这项工作,但从我看,这样做是不值得的。 如果你拥有大量数据,你当然应该想一想把数据指数化的办法。

问题回答

作为一旁,NEVER应使用一种方式。 他们的业绩不佳,X条码应该通过警告向你们发出。 不要忽视警告。

为了进行搜索,我将遵循“Felixyz”所说的话,两点 f,并合并结果。 如果数据变得多余,那么你就希望将“研究所有权”分成一个单独的物体,并与之建立关系和进行公正的搜索。

你们的关系是这样。 即使you从不使用,核心数据也将使用。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签