> ## 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.

# IndexedBatch and Facet

> The photos each part of a run makes searchable, and the index's largest groups.

Use these to show the library while it is indexed, without searching again and again. A sorting screen can call `facets` once, then add each batch's photos to its groups as they arrive.

```swift theme={null}
let groups = try await Rollup.shared.facets(limit: 16, samples: 4)

for await batch in Rollup.shared.indexing.batches {
    add(batch.items)  // animate the new photos into their groups
}
```

Call `facets` again when the state is `ready` to get the final groups.

## IndexedBatch

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

What `Rollup.shared.indexing.batches` reports each time part of a run becomes searchable, about a hundred photos at a time. The stream starts from now: photos indexed earlier are in `search` and `facets`.

**items** `[IndexedItem]`

The photos that just became searchable, newest first.

**indexed** `Int`

Photos done in the whole index once this batch is in.

**total** `Int`

Photos the index's options take, as `IndexingProgress.total`.

A shot's near-duplicates come once, and sensitive photos and screenshots (see [`sensitivity`](https://docs.tryrollup.com/reference/search-results#sensitive-photos)) are left out. A part with nothing to show sends no batch.

## IndexedItem

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

**id** `String`

The PhotoKit local identifier.

**mediaType** `String`

`photo`, `screenshot` or `video`.

**date** `Date?`

When it was taken.

**labels** `[SearchResult.Label]`

What it shows, most confident first, as in [search results](https://docs.tryrollup.com/reference/search-results.md).

## Facet

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

One of the index's largest groups, from `Rollup.shared.facets(limit:samples:)`. Groups on most of the library, or on very few photos, are left out.

**id** `String`

Stable across calls, such as `label:oewn:i51129`, `place:fsq:park`, `cuisine:ramen` or `food`.

**name** `String`

A name to show.

**kind** `String`

`label`, `place`, `cuisine` or `food`.

**count** `Int`

Photos in the group: a shot once, sensitive photos and screenshots not at all.

**sampleIDs** `[String]`

A few of its photos' PhotoKit identifiers, newest first.

## JSON

```json theme={null}
{ "items": [{ "id": "A1B2.../L0/001", "mediaType": "photo", "date": "2026-10-30T18:02:11Z", "labels": [{ "id": "label:oewn:i51129", "name": "dog", "probability": 0.93 }] }], "indexed": 101, "total": 5400 }
```

```json theme={null}
{ "id": "place:fsq:park", "name": "Park", "kind": "place", "count": 212, "sampleIDs": ["A1B2.../L0/001", "C3D4.../L0/001"] }
```


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