I'm using [CSSearchableIndex defaultSearchableIndex] indexSearchableItems: to index my app's content with Core Spotlight.
I'm having problems related to performance, our app has about 600 individual, searchable content items which we need to index. The first time the app launches, we begin to index them, one at a time. For each item of our content, we have to first download the content's thumbnail image from our server (which goes in CSSearchableItemAttributeSet thumbnailImage property).
I've considered using beginIndexBatch/
endIndexBatchWithClientStateas a way of speeding things up, but I am reluctant because of the thumbnail image. In order to batch-index all the content, I would need to first download the thumbnail images for every content item, which is an All or Nothing proposition. If I index the content one item at a time, my belief is, the user will be able to find some content in Spotlight right away, if not all. If I wait until every thumbnail image is downloaded first, it will be many minutes before ANY content is indexed, and if the user closes the app, it will never finish. My belief is that by indexing the content one at a time, I create a set of searchable content earlier.
But, all of this could be avoided if I could index the content WITHOUT having to first download the thumbnail image. But, I cant find any way to set the thumbnnail image URL so I could pass that instead (presumably to let the OS download the image in the background outside ofthe App's execution space).
Now, there is a property called "thumbnailURL" in the CSSearchableItemAttributeSet object. However, the documentation states this is "The local file URL of the thumbnail image..." - so obviously I cannot put a URL here which links to a file on my server, it has to be an image already downloaded (and saved to the local file system).
So, it appears there is no way to avoid downloading the thumbnail images, in which case, I feel I need to use one-by-one indexing. I would love to know what other people are doing in this scenario, and how it might be possible to speed up the indexing process. There are 2 pain points in the process, a) downloading the image, which there is no way to speed up, b) Calling [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems.
I suppose absent any feedback from someone with real world experience doing this, I might try next to use beginIndexBatch/
endIndexBatchWithClientStatebut, not try to process ALL the content in one batch, instead maybe process a dozen at a time or so. That would probably be a good middle ground. Any advice? Thanks in advance.