> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryrollup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SearchResults

> What Rollup's on-device search returns.

```swift theme={null}
public struct SearchResults: Codable, Sendable
```

What `Rollup.shared.search(_:)` returns: every result in order with what the index holds about it, the query as search read it, and how long it took.

<ResponseField name="query" type="String">
  The search as asked.
</ResponseField>

<ResponseField name="results" type="[SearchResult]">
  The results, most relevant first.
</ResponseField>

<ResponseField name="plan" type="SearchPlan">
  How search read the query.
</ResponseField>

<ResponseField name="seconds" type="Double">
  Seconds for the whole search.
</ResponseField>

<ResponseField name="timings" type="[String: Double]">
  Seconds for its parts, by name, such as `locationResolution`, `filtering`, `embedding` and `text`.
</ResponseField>

<ResponseField name="coverage" type="JSONValue?">
  What the index covers: counts, dates and media.
</ResponseField>

## SearchPlan

```swift theme={null}
public struct SearchPlan: Codable, Sendable
```

<ResponseField name="operation" type="String">
  `semantic_search`, `location_search`, `date_search`, `capture_search` or `holiday_search`.
</ResponseField>

<ResponseField name="retrievalIntent" type="String">
  `content`, `place`, `content_and_place`, `place_type`, `holiday` or `metadata`.
</ResponseField>

<ResponseField name="visualText" type="String">
  What was left to match images and text against once dates, media and places were read.
</ResponseField>

<ResponseField name="sort" type="String">
  `most_relevant` or `newest_first`.
</ResponseField>

<ResponseField name="details" type="JSONValue">
  The whole plan: the date, capture, location and place filters search applied, with its policies and counts.
</ResponseField>

## SearchResult

```swift theme={null}
public struct SearchResult: Identifiable, Codable, Sendable
```

One asset and what the index holds about it.

<ResponseField name="id" type="String">
  The asset's PhotoKit local identifier.
</ResponseField>

<ResponseField name="date" type="Date?">
  When it was taken.
</ResponseField>

<ResponseField name="timeZone" type="TimeZone?">
  The time zone where it was taken.
</ResponseField>

<ResponseField name="mediaType" type="MediaType">
  `.photo`, `.video` or `.screenshot`.
</ResponseField>

<ResponseField name="isFavorite" type="Bool">
  Whether the person marked it as a favorite.
</ResponseField>

<ResponseField name="location" type="Location?">
  Where it was taken, as the on-device geography placed it.
</ResponseField>

<ResponseField name="labels" type="[Label]">
  What it shows.
</ResponseField>

<ResponseField name="places" type="[Place]">
  The venue its visit resolved to. Empty when `places` is off or no venue was resolved.
</ResponseField>

<ResponseField name="cuisines" type="[String]">
  Cuisines of its visit, on food photos.
</ResponseField>

<ResponseField name="text" type="String?">
  The text search matches against: sign text, text read from the preview, or a screenshot's text.
</ResponseField>

<ResponseField name="screenshot" type="Screenshot?">
  What was read from a screenshot.
</ResponseField>

<ResponseField name="relevance" type="Double?">
  The relevance model's probability, for image matches.
</ResponseField>

<ResponseField name="matchedText" type="String?">
  The words of the asset's text that hold the query, for text matches.
</ResponseField>

<ResponseField name="score" type="Double?">
  Search's score for this result.
</ResponseField>

<ResponseField name="retrievalScore" type="Double?">
  The retrieval score before ranking.
</ResponseField>

<ResponseField name="placeSimilarity" type="Double?">
  How closely its place matched a place in the query.
</ResponseField>

<ResponseField name="matchReasons" type="[String]">
  Why it matched, such as `image`, `text` or `place`.
</ResponseField>

<ResponseField name="placeMatches" type="JSONValue?">
  The named places the result matched.
</ResponseField>

### Location

<ResponseField name="neighborhood" type="String?" />

<ResponseField name="city" type="String?" />

<ResponseField name="metro" type="String?" />

<ResponseField name="country" type="String?" />

<ResponseField name="countryCode" type="String?" />

<ResponseField name="latitude" type="Double?" />

<ResponseField name="longitude" type="Double?" />

<ResponseField name="description" type="String">
  The neighborhood, city and country that are known, joined with commas.
</ResponseField>

### Label

<ResponseField name="id" type="String">
  The label's concept ID.
</ResponseField>

<ResponseField name="name" type="String">
  The label, such as `sushi` or `dog`.
</ResponseField>

<ResponseField name="probability" type="Double?">
  A probability: Apple's confidence, the dish model's, or the learned selector's.
</ResponseField>

<ResponseField name="similarity" type="Double?">
  The image model's cosine similarity, for labels without a probability.
</ResponseField>

### Place

<ResponseField name="name" type="String">
  The venue's name.
</ResponseField>

<ResponseField name="category" type="String?">
  The venue's category.
</ResponseField>

<ResponseField name="confidence" type="Double">
  How confident the place resolution is.
</ResponseField>

### Screenshot

<ResponseField name="appKind" type="String">
  The kind of app the screenshot was taken in.
</ResponseField>

<ResponseField name="topic" type="String">
  What the screenshot is about.
</ResponseField>

<ResponseField name="action" type="String">
  What the person was doing.
</ResponseField>

<ResponseField name="confidence" type="[String: Double]">
  Each field's top probability, by field: `app_kind`, `topic` and `action`.
</ResponseField>

<ResponseField name="sensitivity" type="[String]">
  Kinds of sensitive content the screenshot holds.
</ResponseField>

<ResponseField name="eventTime" type="String?">
  A date it shows, as `YYYY-MM-DD` or `--MM-DD`, with `THH:MM` when a time was shown.
</ResponseField>

<ResponseField name="temporalRelation" type="String">
  How the shown date relates to when the screenshot was taken.
</ResponseField>

<ResponseField name="entities" type="[Entity]">
  Entities Apple's on-device model read, each with an `id`, a `type` and a `value`.
</ResponseField>

<ResponseField name="entityStatus" type="String">
  Whether entities were read, and if not, why.
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.