1

我正在 iOS 9 中测试新的 Core Sportlight API 功能。索引过程运行良好,但有没有办法定义索引项只能通过“title”属性而不是“title”和“description”进行搜索?

也许你已经比我有更多的信息了。

4

1 回答 1

1

我试过用Objective C来做这件事,而且效果很好。

这取决于使用“CSSearchableAttributeSet”的实现。在 obj C 中,有很多 CSSearchableAttributeSet 的实现,例如

  1. CSSearchableItemAttributeSet_General
  2. CSSearchableItemAttributeSet_Document
  3. CSSearchableItemAttributeSet_Image 等。

我在我的代码中使用了 CSSearchableItemAttributeSet_General 并且我只能通过 title 属性进行搜索。事实上,CSSearchableItemAttributeSet 的特定实现甚至没有“描述”属性。

因此,根据您要搜索的对象类型,您可以使用特定的实现。

我相信它也将是 swift 中的同一个等价类。

-光辉

于 2015-06-11T09:10:59.823 回答