什么是CoreData模型中的访存索引元素? [英] What are Fetch Index Elements in the CoreData Model?

查看:146
本文介绍了什么是CoreData模型中的访存索引元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的xcdatamodel中,两个新字段 byTitleIndex compoundIndex 显示在获取索引元素下。我以前在Xcode中没有看过本节。什么是提取索引元素?

In my xcdatamodel two new fields, byTitleIndex and compoundIndex, are showing under Fetch Index Elements. I have not seen this section before in Xcode. What is a Fetch Index Element?

< img src = https://i.stack.imgur.com/1wIYU.png alt = Xcode xcdatamodel突出显示compoundIndex字段的屏幕截图>

推荐答案

获取索引元素是Apple在WWDC 2017上宣布的新索引API的一部分。它们允许您指定一个或多个索引元素。用于创建索引以更快地进行数据库搜索的属性。在您的情况下, title属性将用于在 Passage实体下创建一个称为 compoundIndex的索引,从而可以更快地搜索标题。

Fetch Index Elements are part of Apple’s new indexing API, announced at WWDC 2017. They allow you to specify one or more Index Elements; properties that are used to create an index for faster database searches. In your case, the "title" property will be used to create an index called "compoundIndex" under your "Passage" entity, allowing for faster title searches.

声明:
https://developer.apple.com/videos/播放/ wwdc2017 / 210 /?time = 628

演示:
https://developer.apple.com/videos/play/wwdc2017/210/?time=997

文档(向下滚动到使用索引):
https://developer.apple.com/documentation/coredata/nsmanagedobjectmodel

Documentation (scroll down to "Working with Indexes"): https://developer.apple.com/documentation/coredata/nsmanagedobjectmodel

这篇关于什么是CoreData模型中的访存索引元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆