You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mike Streeton <mi...@ardentia.co.uk> on 2006/07/25 18:21:02 UTC

Copying documents

I want to copy a selection of documents from one index to another. I can
get the Document objects from the IndexReader and write them to the
target index using the IndexWriter. The problem I have is this loses
fields that have not been stored, is there a way round this.

 

Thanks

 

Mike

 

www.ardentia.com the home of NetSearch

 


Re: Copying documents

Posted by Chris Hostetter <ho...@fucit.org>.
: I want to copy a selection of documents from one index to another. I can
: get the Document objects from the IndexReader and write them to the
: target index using the IndexWriter. The problem I have is this loses
: fields that have not been stored, is there a way round this.

there is no easy way to extract non-stored fields from an index.

if your goal is as you say just to verbatim copy documents from one index
to another, look at the IndexWriter.addIndexes method which merges the
Term lists directly (without trying to reconstruct the orriginal
documents)

if you only want a subset of your orriginal index, clone it's directory,
delete the docs you don't wnat to copy, and then add the index.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org