lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Birendar Singh Waldiya -X (bwaldiya - TCS at Cisco)" <bwald...@cisco.com>
Subject Lucene Index taking a lot to time
Date Tue, 28 Oct 2008 20:33:57 GMT
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
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message