On Tue, 2005-02-01 at 17:28 -0500, Luke Shannon wrote:
> I have a situation where I need to combine the fields returned from one
> document to an existing document.
> 
> Is there something in the API for this that I'm missing or is this the best
> way:
> 
> //add the fields contained in the PDF document to the existing doc Document
> Document attachedDoc = LucenePDFDocument.getDocument(attached);
>             Enumeration docFields = attachedDoc.fields();
>              while (docFields.hasMoreElements()) {
>                      doc.add((Field)docFields.nextElement());
>               }

If you're adding fields to an existing document you need to ensure that
all the existing fields are stored. 

Basically what you need to do is:

1. Retrieve the existing document
2. Remove it from the index
3. Add the new fields
4. Add it back to the index

If you don't remove it from the index you'll have two copies, one with
the new fields and one without. 

If the fields in the existing document are not stored then when you add
it back to the index they will be lost.

-- 
Miles Barr <[EMAIL PROTECTED]>
Runtime Collective Ltd.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to