FAQ
Hi





I have index file around 2GB and when I optimize the index file tomcat is
taking more memory than normal and even after completion of optimization
also it is still taking more memory than the normal memory.. is this way it
will happen or do I need to change any thing to reduce the memory I am
sending the code for optimization .. Please tell me is there any wrong in
the following code.









public static void optimizeIndexing() {

System.out.println("Index Optitmaization
started....");

ERMProperties objProperties
= new ERMProperties();

String strApplicationDataPath
= objProperties.getProperty("applicationDataPath");

String strIndexPath
= strApplicationDataPath + "Index";

File objIndexDir
= new File(strIndexPath);

boolean bNewIndex
= false;

IndexWriter indexWriter
= null;

FSDirectory objFSDirectory
= null;

try{

if
(!objIndexDir.isDirectory()) {


objIndexDir.mkdir();

bNewIndex
= true;

}

objFSDirectory
= FSDirectory.getDirectory(new File(strIndexPath), bNewIndex);

indexWriter
= new IndexWriter(objFSDirectory, new HLAnalyzer(), bNewIndex);

indexWriter.optimize();

}catch(Exception objException){

objException.printStackTrace();

}finally{

try { if (indexWriter !=
null) indexWriter.close(); } catch( Exception exc) { }

try { if (objFSDirectory !=
null) objFSDirectory.close(); } catch( Exception exc) { }

}



System.out.println("Index Optitmaization
Endeded....");

}





Regards,

Ravi Kumar Jaladanki

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedFeb 7, '06 at 3:31a
activeFeb 7, '06 at 3:31a
posts1
users1
websitelucene.apache.org

1 user in discussion

Ravi: 1 post

People

Translate

site design / logo © 2022 Grokbase