QualityDocD provides a dual-engine search layer that spans two data stores. MongoDB’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/juescoryisus/QualityDocD/llms.txt
Use this file to discover all available pages before exploring further.
document_metadata collection powers relevance-ranked full-text and regex content search, while the PostgreSQL search_index table provides a token-based fallback that remains available even when MongoDB is unreachable. The three search endpoints cover broad document discovery (GET /search), fast title autocomplete (GET /search/suggest), and manual re-indexing (POST /search/index).
All search results are company-scoped: non-SUPER_ADMIN users only see documents that belong to their own company, both in MongoDB filters and in PostgreSQL queries.
GET /search
Searches indexed documents using one of three modes. An emptyq returns all indexed documents visible to the user.
Auth: Bearer tokenModule access: MODULE_2 — VIEWER, COMMENTER, CONTRIBUTOR, OPERATOR, COMPANY_ADMIN, SUPER_ADMIN
Query parameters
The search query string. An empty or omitted
q returns all indexed documents without filtering.Controls which search engines are used. Defaults to
"all"."metadata"— MongoDB$textsearch on title and contentText; falls back to PostgreSQL token matching if MongoDB is unavailable."content"— MongoDB regex search specifically on thecontentTextfield."all"— Runs both metadata and content searches, then deduplicates results bydocumentId.
Restricts which token arrays are matched during the PostgreSQL fallback. Defaults to
"all". Has no effect when MongoDB handles the query."title"— only matches tokens intitleTokens"body"— only matches tokens inbodyTokens"all"— matches tokens in either array
How search works
- metadata mode
- content mode
- all mode (default)
When Results carry
mode=metadata (or mode=all) and q is non-empty, the API first attempts a MongoDB $text search across the document_metadata collection. Results are ranked by text relevance score and limited to 30 documents.If MongoDB is unavailable or throws an error, the API automatically falls back to the PostgreSQL search_index table. It tokenizes the query using the same tokenizer used during indexing (lowercase, accent-normalized, stop words stripped) and checks each indexed entry’s titleTokens and bodyTokens arrays for overlap. The field query parameter controls which arrays are checked.source: "mongodb-metadata" (MongoDB) or source: "postgres-index" (PostgreSQL fallback).Response
The search query that was used, or
null if none was provided.The mode that was applied:
"metadata", "content", or "all".Total number of results returned after deduplication.
Array of matching document version result objects.
GET /search/suggest
Returns up to 10 document title suggestions matching a partial query string. Intended for powering autocomplete UI components. Requires at least 2 characters inq.
Auth: Bearer tokenModule access: MODULE_3 — OPERATOR, COMPANY_ADMIN, SUPER_ADMIN
Query parameters
Partial title string to match against. Must be at least 2 characters; shorter values return
{ "suggestions": [] } immediately without querying MongoDB.Response
Array of up to 10 suggestion objects matched by case-insensitive regex on the
title field of the MongoDB document_metadata collection.If MongoDB is unavailable, this endpoint returns an empty
suggestions array rather than an error, to avoid breaking autocomplete UI flows.POST /search/index
Manually tokenizes and (re)indexes a document version into the PostgreSQLsearch_index table. Any existing index entry for the given version is deleted and replaced.
Auth: Bearer tokenModule access: MODULE_1 — OPERATOR, COMPANY_ADMIN, SUPER_ADMIN
Request body
The ID of the document version to index. Must belong to the authenticated user’s company.
How indexing works
The endpoint retrieves the version and its parent document, then calls the tokenizer on both:titleTokens— tokens derived from the document’stitlebodyTokens— tokens derived from the version’scontentTexttokens— the deduplicated union of both arrays
search_index row for the version is deleted before the new row is inserted, ensuring a clean re-index.
Response 200
Always
true on success.Total number of unique tokens stored in the
tokens array for this version.Error responses
| Status | Body | Cause |
|---|---|---|
400 | { "error": "versionId requerido" } | versionId was missing or not a valid integer |
404 | { "error": "Version not found" } | No version with that ID exists in the user’s company |