Optimize the k-way merge by advancing the heap root in place instead of
popping and pushing it for every candidate. Use typed deduplication keys
for INT64 and VARCHAR primary keys, including element-level and group-by
search paths.
Skip late materialization when the search plan has no non-primary target
fields, while preserving the primary field for mixed output fields
required by proxy reranking.
Ensure submitted segcore output-field tasks are joined on exceptional
paths and add correctness and benchmark coverage for the optimized merge
implementations.
https://github.com/milvus-io/milvus/issues/51315
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: #51192
design doc:
docs/design-docs/design_docs/20260708-xgboost-function-chain.md
Add native xgboost FunctionChain expression support for L0 rerank with
FileResource-backed UBJ models.
This change includes:
- xgboost FunctionChain expression registration, parameter validation,
and execution
- FileResource-based UBJ model discovery and local path resolution
- lazy model loading with singleflight, lease/refcount lifecycle
protection, and stale eviction on FileResource sync
- cgo bridge for Arrow C Data based batch prediction
- native C++ UBJ model parser and predictor for supported tree models
- runtime-disabled stub for builds without cgo and with_xgboost
- validation for unsupported params, output modes, feature count
mismatch, invalid models, unsupported objectives, unsupported boosters,
multiclass models, multi-target leaf vectors, and unsupported input
column types
- C++ unit tests, Go tests, native parity tests, and Python client L0
E2E tests
- xgboost FunctionChain design document
L2 rerank support is intentionally deferred because Proxy does not yet
support FileResource sync and local resolution.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: https://github.com/milvus-io/milvus/issues/50571
design doc: docs/design-docs/design_docs/20260624-function-chain-api.md
Add the FunctionChain proto-to-runtime path for ordinary Search L2
rerank. The change converts public FunctionChain protos into ChainRepr,
derives caller-independent read/write metadata, validates
Search-specific inputs in Proxy, and executes public chains through the
existing rerank pipeline.
Add request validation for duplicate stages, unsupported stages,
unsupported system inputs/outputs, unknown schema fields, unsupported
input field types, and hybrid-search usage. Extend REST v2 request
conversion to accept function_chains.
Replace score_combine with num_combine and add typed parameter readers,
repr-based FuncChain construction, chain optimization/pruning helpers,
and model-rerank parameter handling. Add coverage for chain repr
conversion, function/operator behavior, Proxy planning, search pipeline
integration, REST conversion, and REST API cases.
Add the Function Chain API design document and update milvus-proto to
the latest upstream pseudo-version.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: https://github.com/milvus-io/milvus/issues/50816
Add Hugging Face Inference Providers client support for feature
extraction and sentence similarity APIs, and wire it into text embedding
and rerank model providers.
The new provider supports:
- text embedding via feature-extraction
- rerank scoring via sentence-similarity
- Hugging Face router provider selection with hf_provider
- MILVUS_HUGGINGFACE_API_KEY credential fallback
- provider config entries for text embedding and rerank
Also add focused tests for the Hugging Face client, rerank provider, and
paramtable provider docs.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: https://github.com/milvus-io/milvus/issues/46565
Implement boost score evaluation for the Go search reduce pipeline,
including
QueryNode task integration, segcore C API bindings, and score expression
combination support.
Add boost score runner logic in core, expose segment-level boost scoring
to Go,
and cover the new behavior with C++, Go, and Python client tests.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: #50381
Search results can contain non-empty FieldsData even when there are no
matched rows, because FieldsData may only hold empty output-field
templates.
Use result IDs to detect zero-hit search results before running lexical
or
semantic highlight processing.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: https://github.com/milvus-io/milvus/issues/50428
Replace the one-shot jemalloc allocated delta assertion in
TestExportSearchResultAsArrowRecordBatch_NoCMemoryLeak with the same
sliding-window sustained-growth check used by the sibling C memory leak
test.
This avoids false positives from global jemalloc noise while preserving
coverage for real repeated C heap growth across the Arrow export/release
path. Extract the shared jemalloc growth assertion into a helper so both
tests use the same thresholds and measurement strategy.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
https://github.com/milvus-io/milvus/issues/48794
Normalize credential names before building config keys so API key,
AK/SK, and GCP credential lookups work when names contain mixed-case
characters.
Add tests covering mixed-case credential names for all supported
credential types.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
#48986
Replace C++ ReduceSearchResultsAndFillData with a Go reduce pipeline:
- Export per-segment search results as Arrow RecordBatch via C Data
Interface
- HeapMergeReduce: k-way heap merge with PK dedup and GroupBy support
- Late Materialization: single CGO call (FillOutputFieldsOrdered) for
output fields
- ExportSearchResultAsArrow supports extra field IDs for future L0
rerank
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
https://github.com/milvus-io/milvus/issues/46565
design doc:
https://github.com/milvus-io/milvus-design-docs/blob/main/design_docs/20260310-function-chain.md
Adds a new chain package (internal/util/function/chain/) that implements
a composable, Apache Arrow-based pipeline for search result
post-processing (reranking, scoring, merging, filtering, grouping,
etc.). This replaces the legacy rerank utility functions with a
DataFrame-oriented approach that provides better performance and
extensibility.
Key changes:
- New chain package with DataFrame abstraction, operator registry,
expression engine (decay, score combine, round decimal, rerank model),
and operators (merge, sort, filter, limit, select, map, group-by)
- Refactored search_pipeline.go to use chain-based reranking instead of
the legacy rerank package, adding a hybrid_assemble operator for hybrid
search
- Removed legacy rerank utilities (decay_function, rrf_function,
weighted_function, util.go, rerank_base) and simplified remaining rerank
providers to thin wrappers
- Added rerank_meta.go in proxy for structured rerank configuration
parsing
- Comprehensive unit tests and benchmarks for the chain package
- Extended Python and Go integration tests for reranker functions
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
issue: #48646
## Problem
`time.Duration.Milliseconds()` returns `int64`, truncating
sub-millisecond
observations to 0 and destroying low-end histogram resolution for fast
paths.
## Scope
Targeted, not a blanket sweep. Only metrics whose observations can fall
below
1ms are converted; multi-ms metrics are left as-is.
## Converted metrics
Call sites switched to `float64(d.Microseconds()) / 1000.0`, histograms
switched to the new `subMsBuckets`:
- `ProxyApplyPrimaryKeyLatency`
- `ProxyApplyTimestampLatency`
- `ProxyParseExpressionLatency`
- `ProxyReduceResultLatency`
- `ProxyReqInQueueLatency`
- `QueryNodeApplyBFCost`
- `QueryNodeForwardDeleteCost`
- `QueryNodeReduceLatency`
- `QueryNodeSQLatencyInQueue`
- `QueryNodeSQPerUserLatencyInQueue`
- `QueryNodeSQSegmentLatency`
- `QueryNodeSQSegmentLatencyInCore`
- `QueryNodeSegmentSearchLatencyPerVector`
- `RootCoordDDLReqLatencyInQueue`
`QueryNodeSQLatencyInQueue` / `QueryNodeSQPerUserLatencyInQueue` already
had
float observations via `Seconds() * 1000`; only the bucket needed
fixing.
`RootCoordDDLReqLatencyInQueue` previously had no `Buckets:` field at
all and
used the Prometheus default — also fixed here.
## `subMsBuckets`
New variable in `pkg/metrics/metrics.go`: existing exponential `buckets`
with
`0.1, 0.25, 0.5` prepended. Only the 14 in-scope histograms reference
it; the
global `buckets` is unchanged, so other histograms gain no extra
cardinality.
The change is purely additive at the low end — existing boundaries are
not
removed or shifted, P95/P99 queries return identical values.
## Operator note
`RootCoordDDLReqLatencyInQueue` is a special case: before this PR it had
no
`Buckets:` field (used Prometheus default `[0.005, 0.01, ..., 10]`) and
was
observed via `Milliseconds()`, so all sub-ms samples were truncated to 0
and
piled into the `le=0.005` bucket. After this PR, true sub-ms values are
observed accurately and bucketed via `subMsBuckets`. As a result,
dashboards
querying P50/P99 of this metric will show a one-time corrective jump
(typical
P50 moves from ~0.003 ms to ~0.3–0.5 ms) on the deployment cut-over.
This is **not a regression** — it is the metric becoming accurate.
On-call
engineers should be told to expect this jump and not page on it.
The other 13 in-scope metrics previously used `buckets` (1 ms minimum),
so
their truncated sub-ms samples were already piled into the `le=1`
bucket;
their post-PR P50/P99 will shift slightly (typically downward as
resolution
improves), not jump dramatically. No special operator action is needed
for
those.
## Not in this PR
- Multi-ms paths: `RootCoordDDLReqLatency`, `proxy/impl.go` per-RPC,
segment
loading, etcd/tikv kv ops.
- `QueryNodeCGOCallLatency` — mixed latency profile across call types;
needs
per-call-type analysis.
- `QueryNodeDiskCache*` / `QueryNodeSegmentAccess*GlobalDuration` —
deliberately
use `longTaskBuckets`, not `buckets`.
- `DataNode*LatencyInQueue` — background task queues, not request-path.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
https://github.com/milvus-io/milvus/issues/42589
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Semantic Highlighting Feature
**Core Invariant**: Semantic highlighting operates on a per-field basis
with independent text processing through an external Zilliz highlight
provider. The implementation maintains field ID to field name mapping
and correlates highlight results back to original field outputs.
**What is Added**: This PR introduces semantic highlighting capability
for search results alongside the existing lexical highlighting. The
feature consists of:
- New `SemanticHighlight` orchestrator that validates queries/input
fields against collection schema, instantiates a Zilliz-based provider,
and batches text processing across multiple queries
- New `SemanticHighlighter` proxy wrapper implementing the `Highlighter`
interface for search pipeline integration
- New `semanticHighlightOperator` that processes search results by
delegating per-field text processing to the provider and attaching
correlated `HighlightResult` data to search outputs
- New gRPC service definition (`HighlightService`) and
`ZillizClient.Highlight()` method for external provider communication
**No Data Loss or Regression**: The change is purely additive without
modifying existing logic:
- Lexical highlighting path remains unchanged (separate switch case in
`createHighlightTask`)
- New `HighlightResults` field is only populated when semantic
highlighting is explicitly requested via `HighlightType_Semantic` enum
value
- Gracefully handles missing fields by returning explicit errors rather
than silent failures
- Pipeline operator integration follows existing patterns and only
processes when semantic highlighter is instantiated
**Why This Design**: Semantic highlighting is routed through the same
pipeline operator pattern as lexical highlighting, ensuring consistent
integration into search workflows. The per-field model allows flexible
highlighting across different text columns and batch processing ensures
efficient handling of multiple queries with configurable provider
constraints.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
https://github.com/milvus-io/milvus/issues/45544
- Add batch_factor configuration parameter (default: 5) to control
embedding provider batch sizes
- Add disable_func_runtime_check property to bypass function validation
during collection creation
- Add database interceptor support for AddCollectionFunction,
AlterCollectionFunction, and DropCollectionFunction requests
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
- Add enable configuration for all model service providers
- Migrate environment variables from MILVUSAI_* to MILVUS_* prefix with
backward compatibility
- Unify model service enable/disable logic using configuration
- Add tests for environment variable parsing with fallback support
#35856
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
https://github.com/milvus-io/milvus/issues/35856
1. Optimizing decay function
2. Since the decay function is larger, the more similar it is, the
smaller the L2/JACCARD/HAMMING metrics scores the more similar they are.
For these metrics, the decay function regenerates new scores.
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
#35856
1. Add function-related configuration in milvus.yaml
2. Add null and empty value check to TextEmbeddingFunction
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>