Claus Ibsen created CAMEL-26227:
-----------------------------------
Summary: camel-lucene - documents written by insert are stored but
never indexed, so a query never finds them
Key: CAMEL-26227
URL: https://issues.apache.org/jira/browse/CAMEL-26227
Project: Camel
Issue Type: Bug
Components: camel-lucene
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of lucene (CAMEL-24961, PR #28398).
h4. 1. Inserted fields are stored but not indexed
{{LuceneIndexer.createFieldType}} (main 2a465aa4814c, lines 180-189) sets
{{stored}} and {{tokenized}} but never calls {{setIndexOptions}}, so the field
type keeps {{IndexOptions.NONE}}: the fields written by {{lucene:...:insert}}
and by the {{srcDir}} indexing are stored but not indexed. A query for a word
of an inserted body finds nothing ({{TermQuery}} 0 hits,
{{Hits[numberOfHits=0]}}). The integration tests do not show it: the query
tests build their index with {{TextField}}, and the insert-then-query test
asserts that there are no hits. Checked on 4.24.0-SNAPSHOT with an embedded
index.
Proposed: set {{IndexOptions.DOCS_AND_FREQS_AND_POSITIONS}} on both field types
(or use {{TextField}} / {{StringField}}), and fix the insert-then-query test to
expect the hit.
h4. 2. Each header and the body are indexed as separate documents
{{LuceneIndexer.add(String, String, boolean)}} (lines 130-132) creates a new
{{Document}} for every field, so one exchange becomes one document per header
plus one for {{contents}} (and one for {{path}} and one for {{contents}} per
file). A hit on the body cannot be tied to the headers or the file path.
Checked on 4.24.0-SNAPSHOT with an embedded index.
Proposed: add all the fields of one exchange (or one file) to one {{Document}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)