Actually i am doing the right way as you mentioned, having session.save() after each file. But i do have text extractors and indexes turned on. My Configuration: for searchindex: My Index config: jcr:content jcr:data Kindly tell me the optimal way to use them. Thanks Ajai G Guo Du wrote: > > On Mon, Jul 27, 2009 at 2:56 PM, Ajai wrote: >> >> Hi Guo, >> >> Yes, i am adding a document to the repository. >> Is there multiple ways to do a save? >> >> I am doing it the following way, >> >> fileNode = matterNode.addNode(fileName, "nt:file"); >> fileNode.addMixin("mix:versionable"); >> fileNode.addMixin("mix:referenceable"); >> Node resNode = fileNode.addNode("jcr:content", "nt:resource"); >> resNode.addMixin("mix:versionable"); >> resNode.addMixin("mix:referenceable"); >> resNode.setProperty("jcr:mimeType", mimeType); >> resNode.setProperty("jcr:encoding", ENCODING_UTF_8); >> resNode.setProperty("jcr:data", new FileInputStream(file)); >> Calendar lastModified = Calendar.getInstance(); >> lastModified.setTimeInMillis(file.lastModified()); >> resNode.setProperty("jcr:lastModified", lastModified); >> // finally >> session.save(); >> >> Please suggest if any changes can be done. >> > > > Your code doesn't show details of the loop. > > > WRONG > ============== > loop{ // 375000 times > addNode(...) > } > session.save(); > ============== > > > > CORRECT > ============== > loop{ // 375000 times > addNode(...) > session.save(); > } > ============== > You may also add multiple documents before call session.save() to take > advantage of batch process more efficiently. But not after add all > 375000 documents. > > --Guo > > -- View this message in context: http://www.nabble.com/Performance-of-Jackrabbit-tp24619853p24681862.html Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.