Skip to content
Documentation

Operate hybrid search and grounded answers

Index published documentation in Qdrant, evaluate shadow traffic, cut over safely, and operate optional grounded AI answers.

  • 24 min read
  • Updated

Nibleaf v0.2 can retrieve published English, Arabic, and mixed-language content with a tenant-filtered BM25 and dense-vector hybrid index. Results mode remains available without an answer model. Grounded answers are a separate, explicit site opt-in, using either a workspace connection or the instance provider.

The setup below describes v0.2.1 and the current source, including workspace AI keys and Ask AI chat merged in November. The v0.2.0 image predates those workflows. The v0.2.1 production Compose file includes neither Qdrant nor ClickHouse. Use v0.2.1 or a later reviewed image, the optional search overlay, and explicit Compose overrides for these features; adding their variables to .env alone does not enable them.

@nibleaf/search owns language-aware chunking, normalization, sparse vectors, fusion result shaping, citation validation, prompt hardening, and the versioned analytics event contract. @nibleaf/qdrant owns only the versioned collection, payload indexes, alias, and tenant-checked operations through Qdrant's official JavaScript SDK. The server derives every project, deployment, version, language, visibility, and reader page-grant filter; the worker indexes immutable published snapshots. Clients cannot submit scope. The published reader calls TanStack Start server functions through TanStack Query hooks; only the server function reaches the Hono RPC endpoint, preserving its request context and authorization checks.

The collection name is <QDRANT_COLLECTION_ALIAS>_<QDRANT_COLLECTION_VERSION>_<dimensions>. The alias is stable. Chunk IDs are deterministic from tenant, deployment, version, page, ordinal, and content hash, so retries are idempotent. Qdrant's sparse bm25 vector uses an IDF corpus restricted by the same tenant and authorization filter as the query.

Administrators can open Site settings → Workspace → Smart AI to connect OpenAI or OpenRouter with a workspace API key. Verify key and load models checks the key and the provider catalog using GET requests; it does not run a paid inference request or prove that the account has credit. Choose an answer model that supports strict structured outputs, save the connection, then choose Enable with this provider. Saving alone does not enable it. Existing keys stay hidden; leaving the key blank preserves it, and replacement requires explicit confirmation.

Workspace credentials use the existing encrypted project integration store. Set the same INTEGRATION_CREDENTIAL_ENCRYPTION_KEY on the API and worker through your deployment environment. This applies to portable Compose as well as Coolify; setting a value in .env alone is not enough unless the service passes it. Keep it and prior decrypt keys backed up securely. Never store provider keys in public site configuration. An explicitly selected workspace provider never falls back to the instance key. Disabling Smart AI preserves saved connections and keeps ordinary search available.

The embedding model is fixed by the instance so all workspaces use the existing index format and dimensions. Direct OpenAI connections require an OpenAI embedding model. After enabling, publish documentation or choose Build or refresh index. The reader offers AI answers only after the current publication has a READY index with searchable chunks. The settings screen reports index readiness separately from the saved provider selection. Indexing sends published documentation to the selected provider; answering sends the question and authorized source excerpts. Provider usage is billed to the connected account, subject to its limits and Nibleaf's existing answer quotas. There is no automatic purchase or top-up.

OpenAI/ChatGPT OAuth is unavailable until Nibleaf has approval for hosted use. The OpenAI token-sharing guidance distinguishes local open-source use from remotely hosted applications. Do not reuse a user's Codex or ChatGPT session token. API keys work independently of that registration.

For an instance-managed provider, use the existing environment setup below.

Start from .env.production.example. Keep SEARCH_RUNTIME=shadow. Set a Qdrant API key when Qdrant is reachable outside a private container network. Set OPENROUTER_API_KEY and pin SEARCH_EMBEDDING_MODEL. Embeddings use OpenRouter's official TypeScript SDK and default to openai/text-embedding-3-large at 3072 dimensions. The configured dimension must match QDRANT_VECTOR_SIZE; changing the embedding model, dimension, or embedding-input format requires a new collection version.

For the portable production stack, add the v0.2 search overlay to every Compose operation (including pull, up, config checks, and backup automation):

bash
docker compose -f docker-compose.prod.yml -f docker-compose.search.yml up -d

docker-compose.prod.yml does not include Qdrant, so hybrid search needs this overlay. The production Compose file already passes OPENROUTER_API_KEY to the API and worker. The overlay is in the repository, not in the release assets, so a guided-installer directory must fetch it from the matching release tag and use docker-compose.yml as the first file. Coolify and the development stack include Qdrant directly.

To offer answers, set SEARCH_ANSWER_ENABLED=true and pin SEARCH_ANSWER_MODEL. Answer generation uses the same OpenRouter credential through OpenRouter's official TypeScript SDK and native structured output. Then an administrator must enable Grounded AI answers for each intended site. Quotas are atomic per project and day in Redis. Requests also have a separate per-IP minute limit, provider timeout, and request cancellation. If Redis is unavailable, answer quota checks fail closed.

The one-shot answer endpoint (POST /api/public/sites/:id/answer) stays non-streaming. It validates the complete structured response, rejects unknown citations and unsupported claims, and only then returns it. The reader chat assistant streams instead and validates citations when the answer is complete; see Run the AI chat assistant. Search results remain immediate and non-generative.

AI controls stay hidden until the instance can serve them. The editor's AI tab appears only when OPENROUTER_API_KEY is set and AI_DAILY_LIMIT is above zero. The Grounded AI answers setting and the reader's AI answer mode appear when the site has a usable provider and a ready published index. Instance-managed answers additionally require SEARCH_ANSWER_ENABLED=true; a verified workspace connection uses the administrator's explicit Smart AI selection. If the provider fails, drafting returns an error instead of placeholder text.

SEARCH_ANSWER_MODEL and AI_DRAFT_MODEL now default to openai/gpt-6-luna, run at low reasoning effort.

  • If you set either variable, nothing changes: Nibleaf keeps using your model.
  • Changing these models doesn't touch the search index, so it needs no reindex. The embedding model changes separately; see Change the embedding model.
  • Workspace Smart AI connections keep the model they saved. For direct OpenAI keys, the model list now offers GPT-6 models and newer.
  • On Nibleaf's own documentation, answers cost less than half as much as with the previous default and arrive about as fast.

Search now embeds documentation with openai/text-embedding-3-large at 3072 dimensions instead of openai/text-embedding-3-small at 1536. The defaults change together: SEARCH_EMBEDDING_MODEL=openai/text-embedding-3-large, SEARCH_EMBEDDING_DIMENSIONS=3072, QDRANT_VECTOR_SIZE=3072 and QDRANT_COLLECTION_VERSION=v2. The new settings use a new collection, nibleaf_search_active_v2_3072, built next to the one readers use today.

On Nibleaf's own documentation the larger model found the right section more often, most of all for Arabic questions:

ModelEnglish Hit@5 / MRR@10Arabic Hit@5 / MRR@10Mixed Hit@5 / MRR@10
text-embedding-3-small, 15360.9 / 0.670.5 / 0.410.4 / 0.32
text-embedding-3-large, 30720.9 / 0.730.8 / 0.580.7 / 0.47

The test had 10 questions per language and measured dense retrieval only. The English gain is smaller than one question's worth, so read it as no worse in English and clearly better in Arabic.

Cost and time. OpenRouter charges 0.13permilliontokensfor‘text−embedding−3−large‘,against0.13 per million tokens for `text-embedding-3-large`, against 0.02 for text-embedding-3-small. Reindexing Nibleaf's documentation (70 pages, about 335,000 tokens) cost about 0.04andtookabout40seconds.A200−pagesiteofsimilarpagesisaboutonemilliontokens:roughly0.04 and took about 40 seconds. A 200-page site of similar pages is about one million tokens: roughly 0.13 and two minutes.

Storage. Each chunk stores 3072 numbers instead of 1536, so the dense part of the Qdrant collection roughly doubles. Both collections exist until you delete the old one.

Stay on the previous model. Set these three variables on the API and worker before you deploy:

bash
SEARCH_EMBEDDING_MODEL=openai/text-embedding-3-small
SEARCH_EMBEDDING_DIMENSIONS=1536
QDRANT_COLLECTION_VERSION=v1

QDRANT_VECTOR_SIZE follows SEARCH_EMBEDDING_DIMENSIONS unless you set it. If you started from .env.example or .env.production.example, these values are already set, and nothing changes.

Upgrade.

  1. Deploy. Until the switch in step 4, your sites keep working: readers get keyword search results (the same results SEARCH_RUNTIME=shadow always shows), and AI answers and Ask AI are hidden. Editor AI drafting is not affected. The API logs once that hybrid search and AI answers are paused, with both collection names.

  2. Queue a rebuild of every published site:

    bash
    docker compose exec -T server pnpm --filter @nibleaf/server search:reindex-all
    

    It prints how many sites it queued and which it skipped, and why. You can also choose Reindex in one site's search settings; publishing a site indexes it too. Running it again costs nothing extra.

  3. A site that uses its own Smart AI connection is skipped until an administrator opens Site settings → Workspace → Smart AI, chooses Verify key and load models and saves the connection, which records the new embedding model. Then choose Reindex for that site.

  4. Wait until every site's index is READY with the new settings: model openai/text-embedding-3-large, 3072 dimensions and collection version v2. An index rebuilt by a worker that still had the old settings doesn't count. The worker logs that such a run "was queued with other embedding settings". Choose Reindex for that site, or run search:reindex-all again. Then switch the alias:

    bash
    docker compose exec -T \
      -e QDRANT_PREVIOUS_COLLECTION=nibleaf_search_active_v1_1536 \
      -e QDRANT_SWITCH_TO=nibleaf_search_active_v2_3072 \
      server pnpm --filter @nibleaf/qdrant alias:switch
    

    Within 30 seconds, hybrid search and AI answers return for every site whose index was rebuilt. A site that is not rebuilt yet keeps keyword results, and its AI answers stay hidden until its index is READY.

  5. Keep nibleaf_search_active_v1_1536 until you are satisfied. To roll back, set the three variables above and switch the alias back.

The chat assistant uses the same switches as grounded answers: the site's Grounded AI answers setting, a usable provider, and a READY published index. It needs no extra service. Readers open it from the Ask AI button, from the search dialog, with Ask AI about this page on an article, or with an ?ask=<question> link. Conversations are multi-turn and live in the browser tab only; a full reload starts a new chat.

The reader calls a TanStack Start server function, which forwards the visitor's cookie and authorization to POST /api/public/sites/:id/chat and passes the response stream through unchanged. The Hono endpoint derives the tenant, deployment, version, language, visibility, and reader page grants exactly as results and answers do, then streams AG-UI events through TanStack AI. A request can only choose among published languages and versions. It never widens scope.

Each turn runs these steps:

  1. Spend gates run before any provider call: the per-IP minute limit, the conversation's turn and token caps, the project's daily token budget, and the existing daily answer quota (each question counts once). If Redis is unavailable, the turn is refused.
  2. A follow-up question is rewritten into a standalone search query from the bounded conversation history. This is one small extra model call; the first question in a chat skips it.
  3. Hybrid retrieval runs with the usual scope filters. With page context, a second lane searches only that page and slightly boosts its passages, but only when the reader may read it. Without page context, the same lane reads the other sections of pages that have only one or two passages among the best results (the two best-scored such pages), so a question worded differently from a page still gets its steps. Those sections are ranked just under their page's own best result, so they add context without reordering it. The six best results always stay in the answer and each such page is sure of three of the other places, so one page's sections cannot crowd out the other's or the best results. A question the search is not confident about reads nothing more.
  4. If retrieval is not confident enough, the answer model is not called. A follow-up rewrite may already have used the utility model. The reader is told the docs could not confirm an answer and is offered the best-matching articles, plus a Contact support link when the site has one.
  5. Otherwise the answer streams as Markdown with inline [S1] source markers. When the stream ends, Nibleaf validates it and sends a final event that the reader UI uses in place of the streamed text. Each source links to the exact section it came from, using the same heading anchor as the article's table of contents.
  6. After the checked answer is sent, a small extra model call prepares up to three follow-up questions from that answer and its cited topics. Suggestions arrive separately; a new question cancels pending suggestions.

Answers lead with the direct answer, give tasks as numbered steps with the exact button and setting names from the docs, and put commands in code blocks. They reply in the reader's language, including questions that mix Arabic and English. When a vague question matches several different things in the docs, the assistant asks one clarifying question that lists the options instead of guessing. When the docs only partly cover a question, it answers that part and says what is missing.

Set Support link in the site's search settings (an https:// link or a mailto: address) to offer readers a way to reach a person when the docs don't have the answer. Leave it empty to hide the link.

Validation keeps the existing safety rules and relaxes only the formatting rules. An unknown source marker anywhere withdraws the whole answer, as does an answer with no valid citation. Headings, short bold section labels, code blocks, short lead-ins, and lists that cite a source do not need their own marker. A few uncited paragraphs, including an uncited opening summary, are removed from the final answer. If more than a third of the substantive paragraphs are uncited, the answer is withdrawn. A withdrawn answer is replaced with "I couldn't verify this from the docs" and links to the best-matching articles.

Streaming is a trade-off: readers see text as it arrives, so they can briefly see wording that validation later removes or withdraws. The final event always decides what remains on screen and what is stored.

The schema defaults below apply to the current source. Provider availability and answer quality need a live check with your documentation and chosen model; the benchmark later on this page can help compare candidates. Its results do not measure retrieval when the fixtures supply source passages.

VariableDefaultEffect
SEARCH_ANSWER_DAILY_PER_PROJECT200Existing daily answer quota. Each chat question counts once.
SEARCH_ANSWER_RATE_LIMIT_PER_MIN10Per-IP minute limit, applied separately to /answer and /chat.
SEARCH_CHAT_MAX_TURNS20Questions per conversation before readers are asked to start a new chat.
SEARCH_CHAT_MAX_CONVERSATION_TOKENS150000Provider tokens one conversation may use.
SEARCH_CHAT_DAILY_TOKENS_PER_PROJECT2000000Provider tokens per project per UTC day. 0 turns this budget off.
SEARCH_CHAT_HISTORY_MESSAGES6Earlier messages sent to the model with each question.
SEARCH_CHAT_HISTORY_MAX_TOKENS1500Estimated token cap for that history.
SEARCH_CHAT_SUGGESTIONS_TIMEOUT_MS15000The longest a suggested-questions call may take after the answer.
SEARCH_CHAT_UTILITY_MODELemptyOptional OpenRouter model for rewriting follow-ups and suggesting next questions, on workspaces that use OpenRouter. Empty uses each workspace's answer model.

Budgets use provider-reported token usage. When a provider reports none, Nibleaf counts a conservative estimate instead. The site's AI settings can also list up to four suggested first questions for the default language.

The search overlay and .env.production.example currently set SEARCH_CHAT_MAX_CONVERSATION_TOKENS=60000, below the schema default of 150000 and below the largest turn reservation with default history. Set it to 150000 explicitly on a compatible current-source deployment, or evaluate a different budget with its admission rules. A low budget can refuse questions before the provider runs. See the complete settings reference.

Readers can rate each answer with a thumbs up or down, pick a reason, and add a comment. They can change or withdraw a rating. Each rating needs a signed token issued with that answer, so only the reader who received it can rate it.

Conversations and feedback are stored in ClickHouse next to site analytics. This needs ANALYTICS_MODE set to anything other than disabled and a worker processing the analytics queue. After upgrading, run the analytics migrations once to add the conversation tables (migrations 2026110606, 2026110607, and 2026110608):

bash
pnpm analytics:migrate

Every turn records content-free facts: status, no-answer reason, language, version, page asked from, cited pages, model, tokens, provider-reported cost, and response time. These feed the dashboard's usage and cost views and the existing answer analytics and usage metering.

Question, answer, and comment text is stored only when all of the following hold:

  • Save questions to improve your docs is on in the site's search settings (it is on by default).
  • An encryption key is configured: AI_CONVERSATION_ENCRYPTION_KEY (32 random bytes, base64, for example openssl rand -base64 32) on both the API and the worker. Without it, Nibleaf derives a separate key from INTEGRATION_CREDENTIAL_ENCRYPTION_KEY. With neither, no text is stored. The key seals text on its way through the queue; it does not encrypt ClickHouse (see below).
  • The visitor allows it. When the site shows a consent banner, text is stored only after the visitor accepts. Otherwise text is stored unless they declined.

Text is redacted inside the API before it is queued. Redaction removes email addresses, phone and ID numbers (including Arabic-Indic digits), credentials and tokens, and URL query strings. This reduces personal data but is not anonymization, so treat stored conversations as restricted. Queue payloads are sealed with AES-256-GCM, so Redis never holds plaintext. ClickHouse stores the redacted text in plain columns, so the dashboard can search and group it: anyone who can read the ClickHouse database can read conversations. Limit ClickHouse access to the API, the worker and the people who operate them, and use encrypted storage for its disks if your policy requires encryption at rest. Nibleaf never stores reader identity; a per-tab session id is stored only as a salted hash. Private sites keep their conversations marked private.

Rows expire after AI_CONVERSATION_RETENTION_DAYS (default 90, from 1 to 365) through ClickHouse TTL. Project administrators can delete a conversation from the dashboard. Deletion writes a tombstone, removes the rows, and stops a queued write from bringing them back. Deleting a project or workspace removes its conversations as well.

Workspace members find conversations, feedback, unanswered questions, and usage under AI assistant in the project sidebar. Project-bound API keys and OAuth connections with the analytics:read scope can read the same data through the MCP tools list_ai_conversations, get_ai_conversation, get_ai_feedback_summary, list_ai_content_gaps, and get_ai_usage. Like every MCP tool, each call is scope-checked, audited and rate limited per credential. When text is not being saved, responses say why in captureOffReason: setting (the site setting is off) or instance (no encryption key on the server).

Alongside each turn, Nibleaf records content-free chat_* events in analytics_events, through the same pipeline as other site analytics. They never contain question, answer or comment text:

EventRecorded when
chat_openedA reader opens the assistant, with the source: launcher, page_button, search_handoff or deep_link.
chat_question_askedA question passes the spend gates, noting whether it was a follow-up and asked from a page.
chat_first_tokenThe first words of an answer are sent, with the time from the request.
chat_answer_completedA turn ends: answered, no_answer, blocked (refused before any provider call), failed or cancelled. Includes model, provider, latency and whether retrieval came from the cache, and tokens and cost when the provider reported them (not for a stopped or failed turn).
chat_citation_clicked, chat_follow_up_clicked, chat_copy, chat_stop, chat_new_chatThe reader opens a source or a suggested question, copies an answer, stops one, or starts over.
chat_feedback_given, chat_feedback_changedA first rating, or a change or withdrawal (with the previous rating and the reason).
chat_quota_reachedA daily quota, token budget, conversation limit or rate limit refuses a question. Rate-limit refusals are counted once per reader address and minute, and only for a published site.
chat_provider_errorA provider call fails, by phase: condense, retrieval, generation or follow_ups.

Because they are ordinary analytics events, they follow the analytics rules: the server builds them, declared bots are marked with actor_type = 'bot' and left out of reader metrics, a session hash is kept only with consent, and they are batched, retried and replayed after a ClickHouse outage like other events. A browser cannot claim consent is not required where the site's banner applies. They expire with CLICKHOUSE_RAW_RETENTION_DAYS, carry a private site's visibility, and are removed with their conversation or project. Readers' interaction events go to POST /api/public/sites/:id/chat/events (60 a minute per IP), which accepts only the client event names chat_opened, citation_clicked, follow_up_clicked, copy, stop, and new_chat. Completion, quota, provider and feedback events are server-owned.

The conversation tables are registered for retention and erasure like the other analytics tables. Turns and feedback expire after AI_CONVERSATION_RETENTION_DAYS (set it on the API and the worker; migrations re-apply it on boot), the daily usage rollup after CLICKHOUSE_ROLLUP_RETENTION_DAYS, and deleting a project erases them. Turns also record actor_type, so automated traffic never inflates reader metrics (questions, answer rate, satisfaction, engagement). Spend is different: every turn a provider billed counts against the AI budgets and in usage and cost, scripted traffic included.

Each turn reserves a conservative token bound before provider calls, then extends that reservation after retrieval. Admission requires headroom for the largest allowed source context. Both the conversation and UTC-day project budgets are checked atomically in Redis; unused reservation is returned when the turn ends. The API logs a startup warning when configured budgets are too small for the largest turn, or leave room for only a few turns. Model output caps must be honored by the provider for those bounds to hold.

A call stopped before usage is reported is charged at its prompt bound plus full output cap. Stored usage is marked as estimated and cost as unknown. A turn with no provider calls costs zero. When SEARCH_CHAT_UTILITY_MODEL is set, rewriting and suggestion calls have their own model usage; they do not borrow the answer model’s known-cost flag. Daily usage can therefore include a utility model with token/cost totals and zero questions.

Suggestions run after the checked answer and stop at SEARCH_CHAT_SUGGESTIONS_TIMEOUT_MS or when the reader asks another question. Answer latency excludes that later call. Evaluate actual questions per budget on your corpus; token caps are not a promise of a fixed conversation length.

ai_usage_daily keeps totals per project, day and model: billed turns, outcomes, tokens, cost, latency, first-token time and retrieval cache hits. It is rebuilt from the stored turns for each day that changes, so late writes stay exact; deleting a conversation rebuilds only that conversation's days, never days whose turns have already expired. The dashboard overview shows engagement and response times, and the MCP tool get_ai_usage returns the daily usage with totals.

Publishing enqueues an idempotent deployment index job. A retry diffs chunk IDs and payloads, skips unchanged chunks, updates metadata without embedding, and deletes only stale points inside the project and deployment filter. A new deployment reuses dense vectors from the nearest READY predecessor when the complete embedding-input hash matches, so unchanged documentation is not fully re-embedded. Only new or changed chunks call the embedding provider. Access-mode changes reindex the latest deployment; a visibility mismatch returns no hybrid result until convergence. To rebuild existing data, enqueue reindex-project through the search queue. Writes always target the configured versioned physical collection rather than the active read alias, so a new collection can be fully populated before cutover without clearing the serving collection.

Run the repeatable offline fixtures and provider benchmark:

bash
pnpm --filter @nibleaf/search test
pnpm --filter @nibleaf/search eval:rag

The benchmark reads packages/search/eval/rag-answer-fixtures.json, resolves the configured model IDs against OpenRouter's live catalog, and records Arabic, English, mixed-language, citation, groundedness/no-answer, latency, token, and provider-reported cost evidence under output/search-eval/. It does not invent missing cost or usage. Keep output files private if they contain sensitive docs.

Compare shadow retrieval by tenant, language, authorized reader scope, zero-result rate, ranking, and latency. The current server returns legacy results in shadow mode; hybrid failures cannot affect readers. Search telemetry is emitted through SearchAnalyticsEventV1; send that contract to the separate analytics pipeline rather than creating a second search analytics store.

  1. Keep the current alias active and bump QDRANT_COLLECTION_VERSION for a schema, chunker, model, or vector-dimension migration.

  2. Populate the new physical collection and verify exact counts per project, deployment, version, language, visibility, and authorized page set.

  3. Exercise public, workspace, and restricted-reader negative cases in both languages. Confirm private chunks, facets, counts, citations, caches, and analytics context never cross scope.

  4. Switch the alias explicitly, confirming both collection names. For example, after configuring QDRANT_COLLECTION_VERSION=v2 and a 3072-dimension index:

    bash
    QDRANT_PREVIOUS_COLLECTION=nibleaf_search_active_v1_1536 \
    QDRANT_SWITCH_TO=nibleaf_search_active_v2_3072 \
    pnpm --filter @nibleaf/qdrant alias:switch
    

    Then set SEARCH_RUNTIME=hybrid and watch error, no-result, latency, and answer quality signals.

  5. Retain the previous physical collection until the observation window closes.

For an immediate retrieval rollback, set SEARCH_RUNTIME=legacy and recreate the API service with that environment. Environment schemas are read at process startup; changing .env does not update a running process. To roll back a collection migration, point the alias at the retained collection and restore the matching embedding model and dimension. Disabling SEARCH_ANSWER_ENABLED disables instance-managed answers without affecting search results. A selected workspace provider has a separate enablement control; disable Smart AI for that site to withdraw its answers.

Project administrators can set 1–50 results per query (default 12) and independently show or hide reader language/version filters (both default on). Grounded answers default off and the shortcut defaults to ⌘K. An empty authored placeholder falls back to the active language's Paraglide site copy; language overrides first fall back to the project value, then that localized copy.

Settings update only Project.config.search through an organization-scoped compare-and-swap transaction, preserving concurrent sibling config writes. A successful write invalidates local live config immediately; other API replicas converge within the documented 15-second TTL. Missing keys restore defaults.

Authorized members can inspect only the current READY revision. Diagnostics use exact tenant/deployment-scoped Qdrant counts/facets plus one bounded metadata page, never a full corpus scan. Results include logical schema/model/revision identifiers, aggregate counts, distributions, stable run/error codes, and bounded page ID/ordinal/language/version/status metadata. They omit content, titles, paths, hashes, vectors, credentials, physical collection/alias names, and provider payloads. Provider absence means unavailable with unknown counts, never zero. Pagination cursors are versioned, HMAC-signed, and tenant/revision bound.

SearchIndexRun is additive, privacy-minimized state. A partial unique index allows one PENDING/RUNNING row per project. Workers use renewable claims longer than any configured provider timeout, recover the same durable run after a crash, replay READY/DISABLED terminal state idempotently, and reclaim only an expired abandoned claim. Unchanged chunks remain unembedded.

Application rollback may safely leave the table. For an operator schema rollback, stop API/worker processes and execute packages/database/prisma/migrations/20260823180000_search_configuration_diagnostics/rollback.sql. It deletes diagnostics history only; Qdrant data is unchanged.

Project deletion enqueues a project-filtered Qdrant delete across every retained versioned collection under the configured alias prefix. Deployment cleanup uses the same sweep through delete-deployment. Confirm an exact project-scoped count of zero after the job, then apply your normal Qdrant backup-retention policy. Never delete a physical collection while its alias is serving traffic.

Project deletion also enqueues an erase-project-storage job on its own erasure queue. The job waits until the project row is deleted, then removes every object under projects/<projectId>/ (uploaded and imported assets and export artifacts). It runs even without Qdrant, is safe to repeat, and retries apart from the Qdrant delete. If WORKER_QUEUES is an allowlist, include erasure. Without a worker for that queue, jobs wait in Redis and nothing is erased.

Failed attempts back off exponentially for about 45.5 hours. If every attempt fails, the job stays in the queue's failed set until you retry or remove it, and the worker logs one error with the project id. After the first pass succeeds, one final pass runs a day later, because an upload URL signed before the deletion stays valid for an hour and an export already running can still write. An object written after the final pass stays in storage.

This applies to deletions made after upgrading. It does not clean up objects left by earlier deletions. Bucket versioning, replication, and backups follow your own retention policy.

Was this page helpful?