thkeen
thkeen

Reputation: 1857

Is there a limit for number of items (CSSearchableItem) in Core Spotlight CSSearchableIndex in iOS 9?

I have around 110,000 entries (CSSearchableItem) that I want to index into iOS 9 Spotlight Search results. However I only managed to show around 30,000 items. The rest was never indexed / appeared when I do the search. So I'm not really sure if there's a limit for an app to to index its entries into the system.

Thanks.

Upvotes: 14

Views: 1657

Answers (3)

user3016498
user3016498

Reputation: 51

Skoua's guess is partially correct.

try await CSSearchableIndex.default().indexSearchableItems(items)

If you have more than 32767 items, you may call indexSearchableItems() multiple times to index them all.

For example, if you have 50,000 items, then call indexSearchableItems() 50 times and index 1000 items each time.

BTW, I got 131312 items indexed in my app. Maybe more can be indexed, but I have not tested that.

Upvotes: 1

Skoua
Skoua

Reputation: 3603

iOS 16 here. Trying to index more than 32767 items gives me this error:

[index] Item count 78394 exceeded limit 32767

So I guess there is a 32767 items limit.

Upvotes: 1

Massimo Polimeni
Massimo Polimeni

Reputation: 4906

There shouldn't be any limit for your CSSearchableItem. Are you sure that every item has added? I suggest:

  • check the completion block when you add your items for see if you have some errors.
  • check this beautiful post, maybe you did a simple error.

Upvotes: 3

Related Questions