On 4/21/06, Esbach, Brandon <Esbachb(a)tycoelectronics.com> wrote:
Hi Jérémi,
Not quite - the problem I'm having seems to stem from getDocument usage to collect
objects. I've done a bit of testing
I guess to illustrate, here is a snippet of the code I currently use (where the problem
seems to be at least):
____________
#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='XWiki.SampleBookTest001Class' and
obj.name<>'XWiki.SampleBookTest001ClassTemplate' order by obj.name
asc")
#foreach ($item in $xwiki.searchDocuments($sql))
#set($oDocObject= $xwiki.getDocument($item))
#set($bentryobj =
$oDocObject.getObject("XWiki.SampleBookTest001Class"))
#set($initialReqDate =
$oDocObject.display("dtInitialReq","view", $bentryobj))
<tr title="Initial Request Date: ${initialReqDate}">
<td valign="top" width="30%">
[$oDocObject.display("SampleReference","view",
$bentryobj)>$oDocObject.name]
</td>
<td colspan="2" width="50%">
<table border-left="1"
width="98%">
#set($objects=
$oDocObject.getObjects("XWiki.SamplePartEntryClass"))
#foreach($object in $objects)
<tr>
<td
width="50%">$oDocObject.display("PartNum","rendered",$object)</td>
<td
width="50%">$oDocObject.display("DeliveryRequest","rendered",$object)</td>
</tr>
#end
</table>
</td>
<td valign="top"
width="20%">$oDocObject.display("MVSEngineer","view",
$bentryobj)</td>
</tr>
#end
____________
What I'm finding is that the $xwiki.getDocument() call is making the time-to-run for
these details extremely long (removing the getDocument makes this call exremely fast for
130 documents, whereas normally it takes up to and over two minutes, keeping tomcat at 50%
during the collection). You can imagine what happens when more than one person gets a
listing (tried convincing powers-that-be about pagination, not an option they're
willing to allow for this).
My thinking (maybe incorrect) was, remove the getDocument() call and replace with a plain
data query, so that I don't need to gather the actual document object - though maybe
that's the wrong way round?
Look at the function $xwiki.search() which allow you to execute hsql
query without loading the document. Like this you can load the datas
directly.
Jérémi
--
Blog:
http://www.jeremi.info
LinkedIn:
https://www.linkedin.com/profile?viewProfile=&key=1437724
Project Manager XWiki:
http://www.xwiki.org
skype: jeremi23 -- msn et gtalk : jeremi23(a)gmail.com