Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

In Core Spotlight, it requires four consecutive characters to index the content. Only through title or displayName can the content be indexed.

In Core Spotlight, one can only index content by using title or displayName, and it requires four consecutive characters for indexing. These situations occurred in iOS 17 and 18. In iOS 16, I could not only index content by title or displayName, but also by keyword. Moreover, there was no restriction of requiring four consecutive characters. I could index my app content by simply inputting one character. Here is my code.https://github.com/kritto1/corespotlight-bug-test/tree/main

@available(iOS 14, *)
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: "com.qunar.iphone.spotlight", attributeSet: attributeSet)
    searchableItem.expirationDate = .distantFuture

    CSSearchableIndex.default().indexSearchableItems([searchableItem]) { error in
        if let error = error {
        } else {

        }
    }
}

@available(iOS 14, *)
func addToSpotlightIndex() {
    let spotlightHotel = QSpotlightItem(
                        id: "corespotlight_1",
                        title: "查询酒店住宿",
                        contentDescription: "",
                        thumbnailImage: UIImage(named: "img2")?.pngData(),
                        keywords: ["酒店", "住宿"]
                    )
    addItemToIndex(spotlightHotel)
    
    let spotlightFlight = QSpotlightItem(
                        id: "corespotlight_2",
                        title: "查询和预订机票",
                        contentDescription: "",
                        thumbnailImage: UIImage(named: "img2")?.pngData(),
                        keywords: ["查询", "预订", "机票"]
                    )

    addItemToIndex(spotlightFlight)
    
    let spotlightSight = QSpotlightItem(
                        id: "corespotlight_3",
                        title: "查询预订门票",
                        contentDescription: "",
                        thumbnailImage: UIImage(named: "img2")?.pngData(),
                        keywords: ["查询", "预订", "门票"]
                    )

    addItemToIndex(spotlightSight)
}

The Chinese language is not like English. Requiring ​​4 Chinese characters​​ for a search hit is too restrictive. We strongly recommend reducing the minimum requirement to ​​2 characters​​ to improve usability and search efficiency

In Core Spotlight, it requires four consecutive characters to index the content. Only through title or displayName can the content be indexed.
 
 
Q