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

# Search

> Search across all EU frameworks with the Rust SDK.

## Methods

```rust theme={null}
client.search.query(
    q: &str,
    framework: Option<&str>,
    result_type: Option<&str>,
    page: Option<u32>,
    per_page: Option<u32>,
) -> Result<Page<SearchResult>, Law4DevsError>

client.search.iter(
    q: &str,
    framework: Option<&str>,
    result_type: Option<&str>,
    per_page: u32,
) -> impl Stream<Item = Result<SearchResult, Law4DevsError>>
```

***

## Basic Search

```rust theme={null}
let results = client
    .search
    .query("incident notification 72 hours", None, None, None, None)
    .await?;

println!("Found {} results", results.meta.total);
for r in &results.data {
    println!("[{}] {} {}: {}", r.framework_slug.to_uppercase(), r.result_type, r.number, r.title);
}
```

***

## Filtered Search

```rust theme={null}
// Search within a specific framework
let results = client
    .search
    .query("data breach", Some("gdpr"), None, None, Some(20))
    .await?;

// Filter by result type
let results = client
    .search
    .query("encryption", Some("gdpr"), Some("article"), None, None)
    .await?;
```

***

## Auto-Paginate Results

```rust theme={null}
use futures::StreamExt;

let mut stream = Box::pin(client.search.iter("vulnerability disclosure", None, None, 20));
while let Some(result) = stream.next().await {
    let r = result?;
    println!("[{}] {}", r.framework_slug, r.title);
}
```

***

## `SearchResult` Fields

| Field            | Type             | Description                            |
| ---------------- | ---------------- | -------------------------------------- |
| `id`             | `u32`            | Internal ID                            |
| `framework_slug` | `String`         | Source framework                       |
| `result_type`    | `String`         | `article`, `recital`, or `requirement` |
| `number`         | `String`         | Article/recital/requirement number     |
| `title`          | `String`         | Title or first line                    |
| `snippet`        | `Option<String>` | Matched text excerpt                   |
| `score`          | `f64`            | Relevance score                        |
