Skip to content

fix: avoid sending empty analyzer params in runAnalyzer - #2014

Merged
sre-ci-robot merged 3 commits into
milvus-io:2.6from
zch0214:fix/run-analyzer-null-analyzer-params
Aug 18, 2026
Merged

fix: avoid sending empty analyzer params in runAnalyzer#2014
sre-ci-robot merged 3 commits into
milvus-io:2.6from
zch0214:fix/run-analyzer-null-analyzer-params

Conversation

@zch0214

@zch0214 zch0214 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

fix: avoid sending empty analyzer params in runAnalyzer

Fixes #2013

See also #2017 for the master branch.

Problem

VectorService.runAnalyzer() unconditionally calls setAnalyzerParams(JsonUtils.toJson(request.getAnalyzerParams())). Since RunAnalyzerReqBuilder initializes analyzerParams to an
empty HashMap, the collection-based mode (passing collectionName / fieldName without analyzerParams) results in analyzer_params = "{}", which the server rejects with:

run analyzer can't use analyzer params and (collection,field) in same time

Fix

Only set analyzer_params on the gRPC request when analyzerParams is non-empty. The !isEmpty() check is the operative fix (the builder always initializes analyzerParams to an empty map); the != null check is defensive-only.

Verification

  • Before: runAnalyzer(collectionName=..., fieldName="page_content", texts=[...]) fails with the error above.
  • After: the same request succeeds, while the analyzerParams-only mode still works as before.

@sre-ci-robot
sre-ci-robot requested review from yelusion2 and yhmo August 17, 2026 10:45
@sre-ci-robot

Copy link
Copy Markdown

Welcome @zch0214! It looks like this is your first PR to milvus-io/milvus-sdk-java 🎉

@zch0214

zch0214 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

/assign @yelusion2

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (2.6@9663a30). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ava/io/milvus/v2/service/vector/VectorService.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             2.6    #2014   +/-   ##
======================================
  Coverage       ?   62.62%           
  Complexity     ?     3766           
======================================
  Files          ?      426           
  Lines          ?    24412           
  Branches       ?     2358           
======================================
  Hits           ?    15289           
  Misses         ?     7844           
  Partials       ?     1279           
Files with missing lines Coverage Δ
...ava/io/milvus/v2/service/vector/VectorService.java 93.15% <83.33%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify

mergify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@zch0214
zch0214 force-pushed the fix/run-analyzer-null-analyzer-params branch from 9a72118 to 2a489b6 Compare August 18, 2026 02:12
@zch0214 zch0214 changed the title fix: avoid sending "null" analyzer params in runAnalyzer fix: avoid sending empty analyzer params in runAnalyzer Aug 18, 2026
Signed-off-by: zhouchuhang <zch0214@gmail.com>
@zch0214
zch0214 force-pushed the fix/run-analyzer-null-analyzer-params branch from 2a489b6 to 5f7a14e Compare August 18, 2026 03:09
Use actualDbName() to resolve the target database, consistent with other
vector operations, so runAnalyzer in collection mode works with non-default
databases.

Signed-off-by: zhouchuhang <zch0214@gmail.com>
The server requires the collection to be loaded when running the analyzer
in collection mode. Create an index on the vector field and load the
collection before calling runAnalyzer.

Signed-off-by: zhouchuhang <zch0214@gmail.com>
@zch0214
zch0214 force-pushed the fix/run-analyzer-null-analyzer-params branch from f2ead0a to 0d1e035 Compare August 18, 2026 07:10
@yhmo

yhmo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yhmo, zch0214

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot
sre-ci-robot merged commit 56c3f2c into milvus-io:2.6 Aug 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants