Core Spotlight Index 随着时间的推移而缺失

Core Spotlight Index missing over time

我想了解为什么我的核心 Spotlight 索引最终不再显示了

我的策略是在用户第一次打开应用程序时进行索引。成功索引后,我再也没有索引过。一开始一切都很好,索引出现在聚光灯下。然后随着时间的推移(我不确定多长时间,也许几周),索引停止出现,即使我完全没有对它们进行任何更改。

因此我试图了解系统如何处理索引。它会重建它们,从而清除所有以前的索引吗?所以我会负责重新索引?

CSSearchableItem 上,有一个 属性 expirationDate

The date after which the searchable item should no longer exist.

Discussion
If you don’t set the expirationDate property appropriately, the system automatically expires the item after a period of time.

这应该可以解释为什么您的物品会在一段时间后消失。