search runs on the iPhone against the index. It needs no network connection. Rollup learns only how many searches ran, as a count in the SDK’s run reports, never what was searched.
What a query can say
Search reads the parts of the query it understands and matches the rest against what photos show and say:- Dates, such as “last spring”, “in March”, “2025” or a holiday.
- Media, such as “videos” or “screenshots”.
- Places: countries, cities, neighborhoods, venue names and kinds of places, such as “ramen” or “museum”.
- What photos show, matched against the image and its labels.
- Text in images, such as signs, menus and screenshots. Words match as spelled, with or without a trailing “s”. Long words can be a letter or two off, since text on signs is often misread.
results.plan tells you how search read the query: its operation, its retrievalIntent, the visualText left to match after dates, media and places, and the sort.
Results
Results come most relevant first. EachSearchResult carries what the index holds about the asset:
id: the PhotoKit local identifier. Load the image yourself with PhotoKit.dateandtimeZone: when and in which time zone it was taken.mediaTypeandisFavorite.location: neighborhood, city, metro, country and coordinates.placesandcuisines: the venue its visit resolved to, and cuisines for food photos. Empty whenplacesis off.labels: what the photo shows, with probabilities.text: text read from the image, andscreenshotfor what was read from a screenshot.sensitivity: kinds of sensitive content, such as an ID, a health document or nudity.score,relevance,matchedTextandmatchReasons: why it matched.activitiesandcontext: what was done on its visit, and the circumstances.people: the people whose faces are in it, withpeopleon.duplicates: other photos of the same shot. Search shows them once, as this result.
How many results
search returns the 500 most relevant results by default. results.totalCount says how many there were, so you can tell when results were cut. Pass limit for another number, or nil for every result. Only the results returned are read from the index, so a smaller limit is faster on large libraries.
offset: the number of results to skip. The order is fixed, so pages of the same index don’t overlap or skip.
totalCount differs from the first page’s, start again from offset 0.
Sensitive photos
Search does not leave out photos and screenshots with sensitive content. Theirsensitivity is not empty. Drop them before anything leaves the iPhone. query, facets, indexing batches and people() leave them out on their own. See Sensitive photos.
Searching for people
Withpeople on, search(_:people:) keeps only photos with every one of those people in them, then applies limit and offset. Get their ids from people().
Loading images
The SDK returns identifiers, not images. Use PhotoKit to load them:Errors
noIndex: nothing is indexed yet. Wait untilindexing.state.isSearchableis true.notConfigured: callconfigurefirst.accessRevoked: your app’s Rollup key no longer works. See Keys and revocation.