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 Andre Rubin <an...@gmail.com> on 2008/08/30 09:42:59 UTC
Merging 2 indexes
Hey all
I have 2 indexes. Both have an ID field and one or more String fields... I
want to merge these indexes by merging the documents on each index that
match their IDs.
For exmaple:
Index 1:
Doc1:
id: 1234 (*)
text:bla bla
text:abcd
Index2:
DocA:
id:1234 (*)
text:xyz
(*) ID's match
So I wanna merge these documents in a new (or add it to an existing) index,
like this:
New Index:
Doc1:
id: 1234
text:bla bla
text:abcd
text:xyz
Is there a way to do that in an efficient way, like not having to manually
traverse each?
Thanks,
Andre
Re: Merging 2 indexes
Posted by Karl Wettin <ka...@gmail.com>.
30 aug 2008 kl. 09.42 skrev Andre Rubin:
> I have 2 indexes. Both have an ID field and one or more String
> fields... I
> want to merge these indexes by merging the documents on each index
> that
> match their IDs.
> Is there a way to do that in an efficient way, like not having to
> manually
> traverse each?
No. I recommend you go to the data sources and build your merged index
from scratch. Otherwise you would have to extract the data from the
inverted index or get them via the term vectors (if you made them
available at index time). TermVectorAccessor in trunk/contrib/
miscellaneous can help you with that. Last option is if you stored all
the source data in your documents and you know what analyzer you used
to tokenize it with.
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org