Hi
I am encountering a problem and i was wondering if I could get some help. Basically I have a object called Risk and an Object called Contract. The contract has some transient fields that are set by some external source. What I am trying to do is set the values on the transient fields onn contract and index the Risk object (by the way Contract is set as @IndexEmbedded on Risk and Risk has @ContainedIn in Contract).
The problem I am finding is that the values from the transient fields are not set even though the store strategy is YES. Basically I am doing something like this:
Code:
//simulating contract document from external source(different index)
Document contractDocument = new Document();
contractDocument.add(new Field("id", "id", Store.YES, Index.ANALYZED));
contractDocument.add(new Field("contract.values", "contract-values 1", Store.YES, Index.ANALYZED));
contractDocument.add(new Field("contract.values", "contract-values 2", Store.YES, Index.ANALYZED));
contractDocument.add(new Field("contract.values", "contract-values 3", Store.YES, Index.ANALYZED));
contractDocument.add(new Field("reinsured-company", "reinsured-company", Store.YES, Index.ANALYZED));
contractDocument.add(new Field("ref", "reference-xyz", Store.YES, Index.ANALYZED));
Util.populateRiskWithData(contractDocument, contract);
FullTextSession fullTextSession = Search.getFullTextSession(session);
Transaction tx = fullTextSession.beginTransaction();
fullTextSession.index(riskLoaded);
fullTextSession.flushToIndexes();
tx.commit();
The Util class basically takes the Lucene Doucment from a different source and copies the relevant feilds to the transient fields on the contract. After indexing the Risk I try to look for the fields in the document but don't see any. Am i doing something wrong?
Cheeer