# Server-Side Filtering

This page explains how the `entries`, `keys`, and `vsearch` ops filter and page results on the server before anything crosses the socket.

## Server-Side Filtering

| op | Rule |
|---|---|
| `entries` | `pattern` is required. `contains` is a case-insensitive substring match on the raw value. `after` keeps entries whose `updated_at` (or `created_at`) is `>= after`. `limit <= 0` means `100`; the **last** `limit` matches are kept, following the lexicographic key order |
| `keys` | `pattern` is required. `limit <= 0` returns every key with `page = 1`; a positive `limit` returns page `max(page, 1)` and is never capped |
| `vsearch` | `pattern` and non-blank `text` are required. `limit <= 0` means `100` |

Filtering stays on the server so a scan does not ship the whole database across the socket.

Every request builds a fresh `Session` and calls `Select(db)`, because a session's selected database is an unlocked `int` and shared state would let concurrent requests land in the wrong database.

## Related Pages

- [Wire Protocol](/socket-daemon-protocol)
- [Scans and KEYS](/querying)
- [VSEARCH and VSIM](/vector-search-query)
