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

   # Description
   
   [CAMEL-25507](https://issues.apache.org/jira/browse/CAMEL-25507)
   
   `LuceneComponent` parsed every endpoint URI into its single 
`LuceneConfiguration` and passed that same object to every endpoint, so each 
new lucene endpoint overwrote `host`, `operation`, `indexDir`, `analyzer` and 
`maxHits` of the others. The query producer reads them when it is created, at 
route start, after all routes were built. With several lucene endpoints in a 
CamelContext, a query therefore searches the index of the endpoint created 
last, with its analyzer and `maxHits`, and returns no hits or another index's 
documents without an error.
   
   This change parses each URI into a copy of the component configuration 
(`LuceneConfiguration.copy()`, a shallow clone).
   
   This is one of three independent camel-lucene fixes of the same batch 
(inserts after a restart, query producer state, per-endpoint configuration); 
they change different files and apply in any order.
   
   Tests:
   - New `LuceneEndpointConfigurationTest` in camel-lucene: two query endpoints 
on two indexes with different `maxHits`; checks each endpoint's options and 
that each query searches its own index.
   - Without the change: `lucene:indexA:query?... must search its own index (10 
alpha documents) with its own maxHits (5) ==> expected: <5> but was: <0>` (both 
tests fail).
   - With the change, camel-lucene tests pass: 
`LuceneEndpointConfigurationTest` (2), `LuceneIndexAndQueryProducerIT` (4), 
`LuceneQueryProcessorIT` (2), 0 failures.
   
   Found with a TLA+ model of endpoint creation and producer creation: "a query 
producer uses the options of its own endpoint" is violated in 3 steps (create 
endpoint A, create endpoint B, start A's producer). I then reproduced it with 
the real component.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested camel-lucene, including the formatter and import-sort 
plugins; the build did not change any generated file. I did not run the full 
root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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