Execute Search
Searches the document repository using a structured query DSL. Supports full-text search, semantic vector search, and metadata filters — all combinable.
Request
Content-Type: application/json
| Field | Type | Default | Description |
|---|---|---|---|
where | object | — | Search/filter clause tree. |
select | string[] | See below | Fields to return. |
sort | object[] | [{_score, desc}] | Each: field + direction. |
limit | integer | 20 | Results per page (1–500). |
offset | integer | 0 | Pagination offset. |
options | object | {} | See Options below. |
Default select: ["id", "description", "doc_type", "doc_status", "reference_number", "entry_date", "_score"]
Options
| Field | Type | Default | Description |
|---|---|---|---|
include_highlights | bool | false | Return snippets with <b> tags. Needs FTS clause. |
highlight_length | int | 300 | Max chars per snippet (100–2000). |
Where clause types
Combinators
{"and": [clause, clause, ...]}
{"or": [clause, clause, ...]}
{"not": clause}
Full-text search (FTS)
{"fts": {"field": "content", "query": "supply chain risk"}}
field is always "content". The query string supports advanced syntax including phrases, proximity, and boolean operators.
Vector (semantic) search
{"vector": {"target": "content", "query": "employment applications and CVs"}}
target: "content" or "metadata". The query is embedded and compared using L2 distance. Finds conceptually similar documents even when exact keywords don't match.
Comparison operators
eq, ne, gt, gte, lt, lte — each takes field and value:
{"eq": {"field": "doc_type", "value": "Invoice"}}
{"gte": {"field": "entry_date", "value": "2025-01-01"}}
List operators
{"in": {"field": "doc_type", "value": ["Invoice", "Receipt"]}}
{"nin": {"field": "doc_status", "value": ["Draft", "Archived"]}}
String operators
{"contains": {"field": "description", "value": "urgent"}}
{"startswith": {"field": "reference_number", "value": "INV-2025"}}
Query syntax
The query string in FTS clauses supports advanced search syntax:
Keywords (implicit AND)
supply chain risk
Matches documents containing all three words (anywhere in the text, any order).
Exact phrase
"supply chain risk"
Matches the exact phrase — words must appear adjacent and in order.
OR
invoice OR receipt
Matches documents containing either word.
Exclusion (NOT)
contract -draft
Matches "contract" but excludes documents containing "draft".
Prefix matching
inv*
Matches words starting with "inv" — e.g. "invoice", "inventory", "investigation".
Proximity search (NEAR)
*N"contract penalty"
Matches documents where "contract" and "penalty" appear within 10 tokens of each other (default distance).
*N5"contract penalty"
Narrows to within 5 tokens.
Near phrase search
*NP"supply chain" "risk assessment"
Like NEAR but treats multi-word inputs as intact phrases — finds documents where the phrase "supply chain" appears near the phrase "risk assessment".
Combining syntax
"supply chain" risk -draft inv*
Exact phrase "supply chain" AND word "risk" AND NOT "draft" AND any word starting with "inv".
Search mode behaviour
| Clauses | Behaviour |
|---|---|
| FTS only | Ranked by relevance score |
| Vector only | Ranked by embedding similarity |
| FTS + Vector | Intersected, ranked by FTS |
| Metadata only | No ranking — use sort |
| FTS + Metadata | FTS with pre-filter |
| Vector + Metadata | Vector with pre-filter |
Metadata fields
doc_type, doc_status, doc_number, description, from_entity, to_entity, reference_number, entry_date, entry_person, rev_number, date, privileged, islocked, filesbelongto, subdoctype