In IOS17 and IOS18, core spotlight can only match app contents by searching for the displayName, but cannot hit the contents by using keywords. Moreover, when matching the app content by searching for the "displayName", it requires inputting four consecutive characters to achieve a match.These issues did not occur in iOS 16. What is the reason for this? Here is my code.
func addItemToIndex(_ item: QSpotlightItem) {
let attributeSet = CSSearchableItemAttributeSet(contentType: .item)
attributeSet.title = item.title
attributeSet.displayName = item.title
attributeSet.contentDescription = item.contentDescription
attributeSet.keywords = item.keywords
attributeSet.thumbnailData = item.thumbnailImage
attributeSet.contactKeywords = item.keywords
attributeSet.supportsNavigation = true
let searchableItem = CSSearchableItem(uniqueIdentifier: item.id, domainIdentifier: "xxx", attributeSet: attributeSet)
searchableItem.expirationDate = .distantFuture
CSSearchableIndex.default().indexSearchableItems([searchableItem]) { error in
if let error = error {
} else {
}
}
}
Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.
Bug Reporting: How and Why? has tips on creating your bug report.