Claus Ibsen created CAMEL-27680:
-----------------------------------

             Summary: camel-milvus: wrong collection loaded, client not 
autowired, header javaTypes, missing default
                 Key: CAMEL-27680
                 URL: https://issues.apache.org/jira/browse/CAMEL-27680
             Project: Camel
          Issue Type: Bug
          Components: camel-milvus
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-milvus for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/57c94a8fca727538b1401bb2ec0a27878ecb3b9c).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. SEARCH, QUERY and DELETE load the collection of the endpoint, not the 
one of the request
{{MilvusProducer.search()}}, {{query()}} and {{delete()}} call 
{{loadCollection()}} with the collection of the endpoint path, then run the 
request in the body, which names its own collection. When the two differ, the 
producer loads the wrong collection, and a SEARCH or QUERY on a collection that 
is not loaded fails. The status that {{loadCollection()}} returns is not 
checked, so a failed load is silent.
Proposed change: load the collection that the request names, and fail the 
exchange when the load fails.

h4. 2. The client option is not documented and not autowired
The {{client}} field of {{MilvusConfiguration}} has {{@Metadata(autowired = 
true)}} but no {{@UriParam}}. It is missing from the component JSON, and the 
generated {{MilvusComponentConfigurer}} has no autowired names, so a 
{{MilvusClient}} bean in the registry is not used. The only way to set it is 
{{MilvusConfiguration.setClient()}} in Java.
Proposed change: add {{@UriParam(label = "advanced")}} to the field, so the 
option is documented and autowired.

h4. 3. The timeout option has no defaultValue in the metadata
{{MilvusConfiguration.timeout}} defaults to 10000, but its {{@UriParam}} has no 
{{defaultValue}}, so the catalog shows no default.
Proposed change: add {{defaultValue = "10000"}}.

h4. 4. The CamelMilvusOperationStatus header has a wrong javaType and 
duplicates CamelMilvusOperationStatusValue
{{MilvusProducer.populateResponse()}} sets {{CamelMilvusOperationStatus}} to 
{{R.getStatus()}}, an {{Integer}}, while the metadata says {{String}}. 
{{CamelMilvusOperationStatusValue}} gets the same value as an int. Both are 
only set after {{handleResponseStatus()}} passed, so they are always 0.
Proposed change: set the javaType to {{Integer}}, or set the header to the name 
of the {{R.Status}}, and consider deprecating one of the two headers.

h4. 5. The CamelMilvusKeyValue header has javaType String
{{MilvusEmbeddingsDataTypeTransformer.transform()}} reads 
{{CamelMilvusKeyValue}} as an {{Object}} and passes it to Milvus as is, for 
example a {{Long}} for an Int64 primary key. The metadata says {{String}}.
Proposed change: set the javaType to {{Object}}.

h4. 6. The token option has no security label
{{MilvusConfiguration.token}} is marked {{secret}}, but its {{@UriParam}} has 
no label, so it is listed under producer instead of security.
Proposed change: add {{label = "security"}}.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to