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 Martin Rode <ma...@programmfabrik.de> on 2005/09/05 11:22:03 UTC
Optimize, OutOfMemory + Merge
Hi all,
The code snipset below does NOT result in an optimized index in one of
my test cases. As I understand, the optimized index, means that there is
only ONE segment file in the index folder. After this code has run, I
sometimes have 100 segment files in the directory.
When I call optimize() on the writer, most of the time I get OutOfMemory
(even with 800MB for the JVM).
What do I do wrong?
Best,
Martin
---- code snip start -----
// optimize index
IndexReader[] readers = new IndexReader[1];
readers[0] = IndexReader.open(diri);
writer = new IndexWriter(diri+"-optimized", anal, true);
System.out.println("Merging to new Index:
'"+diri+"-optimized'");
writer.addIndexes(readers);
System.out.println("Done Merging.");
readers[0].close();
---- code snip end ----
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Optimize, OutOfMemory + Merge
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
You should call .optimize() instead of merging.
Erik
On Sep 5, 2005, at 5:22 AM, Martin Rode wrote:
> Hi all,
>
> The code snipset below does NOT result in an optimized index in one
> of my test cases. As I understand, the optimized index, means that
> there is only ONE segment file in the index folder. After this code
> has run, I sometimes have 100 segment files in the directory.
>
> When I call optimize() on the writer, most of the time I get
> OutOfMemory (even with 800MB for the JVM).
>
> What do I do wrong?
>
> Best,
> Martin
>
> ---- code snip start -----
> // optimize index
> IndexReader[] readers = new IndexReader[1];
> readers[0] = IndexReader.open(diri);
> writer = new IndexWriter(diri+"-optimized", anal,
> true);
> System.out.println("Merging to new Index: '"+diri+"-
> optimized'");
> writer.addIndexes(readers);
> System.out.println("Done Merging.");
> readers[0].close();
> ---- code snip end ----
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org