import type * as HydraDB from "../../index.js"; /** * @example * {} */ export interface SearchQueryRequest { /** * ACL scopes retrieval to documents the given principals may access * (PRO-1684 document ACLs): a document matches when its stored ACL is * empty (unrestricted, pre-RBAC content and connectors without permission * support), contains __public__, or intersects these principals. Entries * are bare emails or prefixed principals (user_email:/group:/domain:). * Omitted, empty, or ["*"] disables ACL filtering entirely, today's * behavior. Like IDs, the resulting clause survives the metadata * zero-result retry. An entry that is not a known principal fails CLOSED: * it matches only public and unrestricted documents, never restricted. */ acl?: string[]; /** Optional context string prepended to the query to improve retrieval relevance. */ additionalContext?: string; /** Weighting balance between dense and sparse retrieval in hybrid mode. `"auto"` lets HydraDB choose; a number from 0 (full BM25) to 1 (full dense) sets it explicitly. */ alpha?: unknown; /** * Attributes is the go-forward metadata filter: a MongoDB-like operator query * ($eq/$ne/$gt/$gte/$lt/$lte/$in/$nin/$and/$or/$not/$exists) over the * database attributes, translated to a safe Milvus scalar pre-filter by * BuildAttributesFilterExpr (PRO-1618). It composes (AND) with the * deprecated metadata_filters while both exist. Field names are allowlisted * and values escaped, so it is injection-safe. * * It is applied everywhere metadata_filters is, and nowhere else: the * chunks a query returns, the additional context and forceful-relation * chunks (the fail-closed post-filter net in the service), and the graph * paths, which the graph lane prunes by resolving every source a path * cites and dropping the paths that touch one failing the predicate * (disallowedGraphSources). Product decision 2026-09-04: `attributes` * behaves like `metadata_filters` on every part of the response. */ attributes?: Record; /** Collection scope. Defaults to the default collection when omitted. Formerly `sub_tenant_id`; the `sub_tenant_id` alias is still accepted (deprecated). */ collection?: string; /** Preferred /query scope selector. Send either a list of collection IDs for equal normalized weighting, or an object mapping collection ID to a positive relative ranking weight with at most one decimal place. Do not send together with the deprecated sub_tenant_ids or sub_tenant_id. */ collections?: HydraDB.SearchQueryRequestCollections; /** * Database is the canonical v2 name for the tenant scope. TenantID is its * deprecated alias and remains fully accepted. The TenantAliases middleware * reconciles the two before binding, so TenantID is always populated and the * handler reads it; Database/Collection are carried only for docs/OpenAPI. */ database?: string; /** Whether to include graph context in the response. Defaults to true for /query when omitted. */ graphContext?: boolean; /** * GraphVectorPrune switches the graph-connected-chunks lane from "fetch * graph-selected chunks and let the fusion reranker sort them out" to "fetch * a wider graph-selected candidate pool, then rank that pool by Milvus vector * similarity, fully replacing the final chunk list." Works in either fast or * thinking mode. Default false preserves existing behavior. Also gated * server-side by a repo-level config flag (SearchService's * graphVectorPruneEnabled) — if that flag is off, this is forced to false * regardless of what the request sets, so a deployment can disable the * mechanism without any client-side change. */ graphVectorPrune?: boolean; /** * GraphVectorPruneSpacyEntities: when GraphVectorPrune is also set, swaps the * graph lane's entity-extraction source from the default LLM-based extractor * to a local spaCy subprocess (faster, no network round trip, but a * narrower/mismatched entity vocabulary versus the graph's own LLM-extracted * node names). No-op if GraphVectorPrune is false (including when forced * false by the server-level flag) or no spaCy extractor was configured at * startup. */ graphVectorPruneSpacyEntities?: boolean; /** * IDs optionally scopes retrieval to specific source ids. The v2 wire field is * `ids` (matching /context/list); empty means search the whole corpus. Applied * as a Milvus `source_id in [...]` pre-filter that is preserved across the * metadata zero-result retry, so a source-scoped search that matches nothing * returns nothing rather than silently widening to the whole corpus. */ ids?: string[]; /** Maximum number of chunks to return. */ maxResults?: number; metadataFilters?: HydraDB.SearchMetadataFilters; mode?: HydraDB.SearchRecallMode; /** Number of adjacent chunks to pull alongside each matched chunk for additional context. */ numRelatedChunks?: number; operator?: HydraDB.SearchOperator; /** * ProfileEntityType/ProfileNamespace refine the subject's graph identity; * defaults ("PERSON"/"users") cover the common case of a person subject. */ profileEntityType?: string; profileNamespace?: string; /** * ProfileSubject names the entity whose compiled profile should ride the * response as profile_context/profile_filter (PRO-1797). Payload-only: * chunk ranking is never altered. Omitted = no profile block. Dark until * the repo-level ENTITY_PROFILE_CONTEXT_ENABLED flag is on. */ profileSubject?: string; /** Natural-language search query. */ query?: string; /** Whether to include app-aware knowledge retrieval. Applies to knowledge hybrid queries. Defaults to true when omitted; pass false to search files only. */ queryApps?: boolean; /** Retrieval method to use for the query. */ queryBy?: HydraDB.SearchQueryBy; /** Whether to force relation expansion for graph-aware query retrieval. Defaults to true when omitted. */ queryForcefulRelations?: boolean; /** Recency boost applied to ranking (0.0-1.0). Omit it to get the always-on default baseline of 0.40 (a bounded <=40% swing on normalized relevance — it reorders within a relevance gap of up to 0.40 but never buries a more strongly relevant result); send 0 to disable recency entirely; higher values favour more recent sources more strongly. */ recencyBias?: number; /** Deprecated for /query (since 2.0.1). Use collection for a single scope or collections for multiple. Backwards-compatible and will be removed in a future version. Do not send together with a multi-scope selector. */ subTenantId?: string; /** Deprecated for /query (since 2.0.1). Use collections instead; it accepts the same list or weighted-object shape. Backwards-compatible and will be removed in a future version. Do not send together with collections. */ subTenantIds?: HydraDB.SearchQueryRequestSubTenantIds; temporalIntent?: HydraDB.SearchTemporalIntentOverride; /** * TemporalNow optionally anchors "now" for temporal reasoning (ISO-8601). * Callers replaying past conversations (or backfilling) must supply it or * to-now durations and recency windows resolve against the server's wall * clock (LongMemEval measured 0 exact to-now durations from this alone). */ temporalNow?: string; /** * TemporalReasoning activates the temporal read path: the query is classified * into a temporal mode (current/as-of/range/upcoming...), matching edge-level * temporal facts are resolved from the edge_temporal store and ride back on * the response (temporal_facts / temporal_duration / temporal_filter). * CONTRACT: chunk ranking is NEVER altered — ON returns the same chunks as * OFF; the layer is additive payload + computed answers only (rank shaping * measured net-negative on BEAM/LongMemEval/TEMPO; see temporal_filters.go). * Optional; ON by default — pass temporal_reasoning:false to disable. * Resolved by GetTemporalReasoningOrDefault (ownership rule). */ temporalReasoning?: boolean; /** deprecated: use database */ tenantId?: string; /** Optional exact document-title filter. Values are matched case-insensitively and ORed, resolved to source IDs, then the normal query pipeline runs within that source scope. When ids is also supplied, the two filters are intersected. */ titles?: string[]; /** Corpus to query. Split database: knowledge (the default), memory, or all (both, merged). Unified database: omit it, or send unified (all is accepted and means the same); knowledge and memory are rejected there. */ type?: HydraDB.SearchSourceType; }