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 "Killeen, Tom" <to...@thomson.com> on 2003/09/16 14:37:37 UTC

merging indices

Hello - 

I have created 27 separate indices that hold a total of 15.8 million XML
documents.  My question is, would I be better served to have one large index
or multiple indices as I have?  Also does anyone have any sample code of how
I merge these indices?  I have seen the addIndexes(Directory[]) method and
am not quite sure how to implement it.

thanks, 
Tom 

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


Re: merging indices

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Tom,

Not sure which one would be better for you.  It would be easy for you
to test that, though.  My guess would be that a single index will work
better.

To merge indices, create a new instance of FSDirectory.
  Directory dir = new FSDirectory("/path/to/new/index");

Then create an array of your 27 indices (something like the above, but
add it to an array of Directory[] type, and use a different path for
each of your 27 dirs in the ctor above) and pass it to addIndexes
method, like this:
  dir.addIndexes(yourDirectoryArray);

The 'dir' is the 'dir' from above.

Otis


--- "Killeen, Tom" <to...@thomson.com> wrote:
> Hello - 
> 
> I have created 27 separate indices that hold a total of 15.8 million
> XML
> documents.  My question is, would I be better served to have one
> large index
> or multiple indices as I have?  Also does anyone have any sample code
> of how
> I merge these indices?  I have seen the addIndexes(Directory[])
> method and
> am not quite sure how to implement it.
> 
> thanks, 
> Tom 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


Re: merging indices

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Tom,

Not sure which one would be better for you.  It would be easy for you
to test that, though.  My guess would be that a single index will work
better.

To merge indices, create a new instance of FSDirectory.
  Directory dir = new FSDirectory("/path/to/new/index");

Then create an array of your 27 indices (something like the above, but
add it to an array of Directory[] type, and use a different path for
each of your 27 dirs in the ctor above) and pass it to addIndexes
method, like this:
  dir.addIndexes(yourDirectoryArray);

The 'dir' is the 'dir' from above.

Otis


--- "Killeen, Tom" <to...@thomson.com> wrote:
> Hello - 
> 
> I have created 27 separate indices that hold a total of 15.8 million
> XML
> documents.  My question is, would I be better served to have one
> large index
> or multiple indices as I have?  Also does anyone have any sample code
> of how
> I merge these indices?  I have seen the addIndexes(Directory[])
> method and
> am not quite sure how to implement it.
> 
> thanks, 
> Tom 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com