CSSearchableItemAttributeSet contentType for search results

I am creating an application that uses CSSearchableItemAttributeSetc NSUserActivityto add elements to the Spotlight search index. The indexes I index are emojis, which consist of the character of the emoji itself, the description and the image that displays the emoji. I create an action and then bind an element attribute to it that allows me to specify a thumbnail.

My question is what should be the content type for CSSearchableItemAttributeSet?

At first I thought it should be kUTTypeImage. But the image is not an indexed element, it is an emoji symbol. Image contains only additional information.

NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:@"com.domain.appname-something"];
activity.title = @"<emoji here>";

CSSearchableItemAttributeSet *contentAttributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage]; //QUESTION: What’s the appropriate contentType?
contentAttributeSet.contentDescription = @"<emoji description here>";
contentAttributeSet.thumbnailData = [self generateEmojiImage];

activity.contentAttributeSet = contentAttributeSet;
+4

Source: https://habr.com/ru/post/1621656/


All Articles