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

# Indexes & Search

> Indexes turn raw media into searchable knowledge. Search returns playable evidence - timestamps and stream URLs you can verify.

## Quick Example

```python theme={null}
import videodb

conn = videodb.connect()
video = conn.get_collection().upload(url="https://example.com/video.mp4")

# Create an index with a prompt
index_id = video.index_scenes(
    prompt="Extract key decisions and action items"
)

# Search returns playable evidence
results = video.search("budget approval", index_id=index_id)
for shot in results.shots:
    print(f"{shot.start}s: {shot.text}")
    shot.play()  # Opens in browser
```

<img src="https://mintcdn.com/videodb/6KL5X6-sIPSRpEUt/assets/indexing/with-without-indexes.webp?fit=max&auto=format&n=6KL5X6-sIPSRpEUt&q=85&s=6e5a1579b89cd65578bf954757c7b3f7" style={{width: "auto", height: "auto"}} alt="Comparison showing video search results with and without indexing, demonstrating how indexing finds exact moments" width="7680" height="4100" data-path="assets/indexing/with-without-indexes.webp" />

***

## Index Types

<img src="https://mintcdn.com/videodb/6KL5X6-sIPSRpEUt/assets/indexing/scene-index.webp?fit=max&auto=format&n=6KL5X6-sIPSRpEUt&q=85&s=619bc32606efd38518d328a996eb0c9d" style={{width: "auto", height: "auto"}} alt="Scene index visual example showing search query 'Show me the bomb explosion scene' with matching video frames and timestamps" width="1200" height="630" data-path="assets/indexing/scene-index.webp" />

| Type       | Method                       | Use Case                        |
| :--------- | :--------------------------- | :------------------------------ |
| **Visual** | `video.index_scenes()`       | Describe scenes, detect objects |
| **Spoken** | `video.index_spoken_words()` | Transcripts, spoken content     |
| **Audio**  | `rtstream.index_audio()`     | Audio analysis, topics          |

### Key Properties

* **Prompt-driven** - You define what to extract with natural language
* **Additive** - Multiple indexes on the same media
* **Non-destructive** - Add/remove without affecting source

```python theme={null}
# Multiple indexes = multiple perspectives
safety_index = video.index_scenes(prompt="Identify safety issues")
summary_index = video.index_scenes(prompt="Summarize each segment")
transcript = video.index_spoken_words()
```

***

## Search Scopes

```python theme={null}
# Single video
results = video.search("product demo")

# Single stream
results = rtstream.search("intrusion")

# Collection-wide
results = coll.search("quarterly results", index_type="scene")
```

***

## Playable Evidence

Every search result includes playable proof:

```python theme={null}
for shot in results.shots:
    shot.start        # 45.2 (seconds)
    shot.end          # 52.8
    shot.text         # "CEO announces Q3 results"
    shot.search_score # 0.87
    shot.play()       # Verify the result
```

***

## Multi-Index Search

Search across visual and spoken content:

```python theme={null}
results = video.search(
    query="budget discussion",
    index_type=["scene", "spoken_word"]
)
```

* **Union** - Broader recall (results from any index)
* **Intersection** - Higher precision (matches in all indexes)

***

## Best Practices

1. **Be specific in prompts** - "Identify safety violations" beats "describe what you see"
2. **Use specific queries** - "red car entering lot" beats "car"
3. **Verify with playback** - Always validate with `shot.play()`
4. **Create focused indexes** - One index per question or domain

## What You Can Build

<CardGroup cols={2}>
  <Card title="Keyword Search Compilation" icon="search" href="/examples-and-tutorials/video-rag/keyword-search">
    Create highlight reels from keyword-based search
  </Card>

  <Card title="Multimodal Search" icon="brain" href="/examples-and-tutorials/video-rag/multimodal-search">
    Combine visual and spoken indexes for powerful queries
  </Card>

  <Card title="Character Clips" icon="user" href="/examples-and-tutorials/video-rag/character-clips">
    Extract clips featuring specific people from video libraries
  </Card>
</CardGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card icon="list" title="Indexing Guide" href="/pages/understand/indexing-pipelines/create-an-index">
    Detailed indexing patterns
  </Card>

  <Card icon="search" title="Semantic Search" href="/pages/understand/search-and-retrieval/natural-language-query">
    Advanced search techniques
  </Card>
</CardGroup>
