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

> Full-text search across all EU frameworks with the Flutter SDK.

## Overview

The search resource lets you query articles, recitals, and annexes across all 19 EU frameworks simultaneously. Optionally filter by framework or result type.

***

## Methods

### `query()`

```dart theme={null}
Future<Page<SearchResult>> query(
  String q, {
  String? framework,
  String? resultType,
  int? page,
  int? perPage,
})
```

**Parameters**

| Parameter    | Type      | Description                                   |
| ------------ | --------- | --------------------------------------------- |
| `q`          | `String`  | Search query                                  |
| `framework`  | `String?` | Filter by framework slug (e.g. `gdpr`)        |
| `resultType` | `String?` | Filter by type: `article`, `recital`, `annex` |
| `page`       | `int?`    | Page number                                   |
| `perPage`    | `int?`    | Items per page                                |

### `iter()`

```dart theme={null}
Stream<SearchResult> iter(String q, {String? framework, String? resultType, int perPage = 20})
```

***

## Model

### `SearchResult`

| Field           | Type      | Description                      |
| --------------- | --------- | -------------------------------- |
| `id`            | `int`     | Internal ID                      |
| `frameworkSlug` | `String`  | Source framework                 |
| `type`          | `String`  | `article`, `recital`, or `annex` |
| `number`        | `String`  | Item number                      |
| `title`         | `String?` | Item title                       |
| `matchContext`  | `String?` | Surrounding matched text snippet |

***

## Examples

### Basic search

```dart theme={null}
final results = await client.search.query('incident notification 72 hours');
print('Found ${results.meta.total} results');

for (final r in results.data) {
  print('[${r.frameworkSlug.toUpperCase()}] ${r.type} ${r.number}: ${r.title}');
}
```

### Search within a specific framework

```dart theme={null}
final results = await client.search.query(
  'data breach',
  framework: 'gdpr',
);
```

### Filter by type

```dart theme={null}
final results = await client.search.query(
  'supply chain security',
  resultType: 'article',
);
```

### Auto-paginate search results

```dart theme={null}
await for (final r in client.search.iter('personal data')) {
  print('[${r.frameworkSlug}] ${r.number} — ${r.title}');
}
```
