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:
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
My Index config:
<?xml version="1.0"?>
<!DOCTYPE configuration SYSTEM
"http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd">
<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
<index-rule nodeType="nt:file">
<property>jcr:content</property>
</index-rule>
<index-rule nodeType="nt:resource">
<property>jcr:data</property>
</index-rule>
</configuration>
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<[email protected]> 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.