oscerd opened a new pull request, #26192:
URL: https://github.com/apache/camel/pull/26192

   ## Issue
   
   [CAMEL-24542](https://issues.apache.org/jira/browse/CAMEL-24542)
   
   ## Problem
   
   `QdrantHeaders.PAYLOAD_SELECTOR` (`CamelQdrantPointsPayloadSelector`) is 
declared with `@Metadata` and
   advertised in the generated `qdrant.json`, but it was never read anywhere in 
the component. Both read
   operations built the selector from the `CamelQdrantWithPayload` boolean only:
   
   ```java
   // retrieve
   WithPayloadSelectorFactory.enable(in.getHeader(
           QdrantHeaders.INCLUDE_PAYLOAD, 
QdrantHeaders.DEFAULT_INCLUDE_PAYLOAD, boolean.class)),
   
   // similaritySearch
   .setWithPayload(enable(in.getHeader(
           QdrantHeaders.INCLUDE_PAYLOAD, 
QdrantHeaders.DEFAULT_INCLUDE_PAYLOAD, boolean.class)));
   ```
   
   A route that set a `Points.WithPayloadSelector` to request specific payload 
fields was silently given
   the whole payload.
   
   ## Fix
   
   Both operations resolve the selector through one helper — an explicit 
`PAYLOAD_SELECTOR` header wins,
   otherwise the `INCLUDE_PAYLOAD` boolean selects all or nothing exactly as 
before:
   
   ```java
   private static Points.WithPayloadSelector payloadSelector(Message in) {
       Points.WithPayloadSelector selector = in.getHeader(
               QdrantHeaders.PAYLOAD_SELECTOR, 
Points.WithPayloadSelector.class);
       if (selector != null) {
           return selector;
       }
       return enable(in.getHeader(
               QdrantHeaders.INCLUDE_PAYLOAD, 
QdrantHeaders.DEFAULT_INCLUDE_PAYLOAD, boolean.class));
   }
   ```
   
   Wiring the header up was preferred over deleting the constant: it maps 
directly onto a real Qdrant
   capability (`WithPayloadSelectorFactory.include` / `exclude`) that the 
component otherwise cannot
   reach, and it is backwards compatible — a route that does not set the header 
is unaffected.
   
   ## Test
   
   `QdrantPayloadSelectorIT` runs against a real Qdrant container. It upserts a 
point carrying two
   payload fields, `keep` and `drop`, then asserts:
   
   - `RETRIEVE` with `include("keep")` returns a payload with **only** `keep`
   - `RETRIEVE` with no selector and `INCLUDE_PAYLOAD=true` still returns 
**both** fields (the fallback)
   - `SIMILARITY_SEARCH` with `include("keep")` returns a payload with **only** 
`keep`
   
   Verified that exactly the two selector tests fail before the change (`drop` 
comes back) and that the
   fallback tests pass either way.
   
   Module suite green: 12 unit tests and 26 integration tests. Full reactor 
build clean.
   
   ## Documentation
   
   Behaviour change documented in `camel-4x-upgrade-guide-4_23.adoc` — a route 
that already sets the
   header starts receiving only the payload fields it selected.
   
   ---
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to