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

1.4k Views Asked by At

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.

3

There are 3 best solutions below

0
On

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.
0
On

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.

0
On

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.