I've been exploring the Trails Sample App from this session at WWDC24.
The app has a TrailEntity
of type AppEntity
which is leveraged in multiple places throughout the app, including:
- The
GetTrailInfo
App Intent with atrail
parameter of typeTrailEntity
. - A parameterized App Shortcut which calls the
GetTrailInfo
intent. - The
TrailDataManager
's init callsupdateSpotlightIndex()
, which creates aCSSearchableItem
for eachTrail
in the app, along with anassociateAppEntity
call linking the correspondingTrailEntity
to each item that gets added to theCSSearchableIndex
.
If you build the app and search "trails"
in Spotlight, the Trails Sample App section includes instances of TrailEntity
as search results. But if you comment out the App Shortcut that takes a TrailEntity
as a parameter and rebuild, there are no instances of TrailEntity
in the search results. In both cases, the console prints [Spotlight] Trails indexed by Spotlight
.
Is this expected behavior? Why are the TrailEntity
instances only appearing in Spotlight via the App Shortcut? Shouldn't the CSSearchableItem
instances show up in Spotlight on their own regardless? If not, then what is the purpose of adopting Core Spotlight with App Entities? Does this add the app entities to the semantic index for "new Siri", even though they're not user facing in the Spotlight UI?