Java Mailing List Archive

http://www.java2.5341.com/

Home » java-user.lucene »

Lucene Index taking a lot to time

Birendar Singh Waldiya -X (bwaldiya - TCS at Cisco)

2008-10-28

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi Gurus,

We are using Lucene for creating indexes on some database column and
suddenly my indexcreation time sems to have increased considerably,

Here is the code snippet we are using , we are wondering how come the
index creation has increaed suddenly..any pointer please

Date start = new Date();
 Map inputParams = new HashMap();
     IndexWriter writer = new
IndexWriter(SDSUtil.getSDLuceneIndexDirectory(), new
StandardAnalyzer(),true, IndexWriter.MaxFieldLength.UNLIMITED);
 //IndexWriter writer = new
IndexWriter(SDSUtil.getSDLuceneIndexDirectory(), new
StandardAnalyzer());
 logger.info("Adding records - Before creating Lucene Index");
 CreateLuceneIndexPr createLuceneIndexPr = new
CreateLuceneIndexPr(sdsJdbcTemplate, writer);
 Map outParams = createLuceneIndexPr.execute(inputParams);
 
 //now add partner Exceptions also to index
 List ptnrExcpnList = getPartnerExceptionList("vipmistr"); //TODO:
change it:passing userId as blank to get all prtnr Excpns
 
for (Iterator iter = ptnrExcpnList.iterator(); iter.hasNext();) {
  PartnerException partnerException = (PartnerException) iter.next();
  Document doc = new Document();
  doc.add(new Field("intd_id", "",
org.apache.lucene.document.Field.Store.NO,
org.apache.lucene.document.Field.Index.NOT_ANALYZED));
        doc.add(new Field("cntry_id", "",
org.apache.lucene.document.Field.Store.NO,
org.apache.lucene.document.Field.Index.NOT_ANALYZED));
        doc.add(new Field("Technology_Node", "",
org.apache.lucene.document.Field.Store.YES,
org.apache.lucene.document.Field.Index.NO));
        doc.add(new Field("product_id", "",
org.apache.lucene.document.Field.Store.NO,
org.apache.lucene.document.Field.Index.NOT_ANALYZED));
        doc.add(new Field("RULE_AUT_SPEC", "",
org.apache.lucene.document.Field.Store.YES,
org.apache.lucene.document.Field.Index.NO));
        doc.add(new Field("ptnrExcpn",
partnerException.getPgtmvBeId(),
org.apache.lucene.document.Field.Store.YES,
org.apache.lucene.document.Field.Index.NOT_ANALYZED));
        writer.addDocument(doc);
 }
 logger.info("Optimizing...");
 writer.optimize();
 writer.close();
 Date end = new Date();
 logger.info("#################Index Create Time :-->>>>> " +
(end.getTime() - start.getTime()) + " milliseconds");
} catch (Exception e) {
 if (e instanceof DAOException) {
  throw (DAOException) e;
 } else {
  e.printStackTrace();
  throw new DAOSystemException("error.admin.error",e);
 }
}
}



--------------------------
Thanks & Regards
Birendar
Ph#919-392-5181

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.