Hi Antonio,
On May 15, 2008, at 9:42 PM, Antonio Goncalves wrote:
Thanks Jean-Vincent it works. Two more questions.
1) On the API (
http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.…)
it says that the method getWeb is deprecated and that we should use
getSpace. But when I do the following it doesn't work (doc.space
instead of
doc.web) :
#set($query="where doc.*space*='Main'")
#set($results = $xwiki.searchDocuments($query, 5, 0))
#foreach ($item in $results)
* $item <br/>
#end
Looking at the API this should work no ?
no :)
This javadoc is about the XWiki Java API. The string you're using for
the query is not calling Java code. It's just a HQL string for doing &
query.
2) the code ** $item <br/>* just gives me the
title of the page,
and what
if I want to include the entire content of each page. How can I do
that ?
Check the javadoc for the Document object.
You'll get the Document object like this: $xwiki.getDocument($item)
Note that there are lots of code snippets that should provide examples
on this in
code.xwiki.org, in the snippets area. Let us know where
you'd have expected help on this in
xwiki.org so that we can fix it.
Thanks
-Vincent
2008/5/15, Jean-Vincent Drean <jv(a)xwiki.com>om>:
>
> On Thu, May 15, 2008 at 6:33 PM, Antonio Goncalves
> <antonio.mailing(a)gmail.com> wrote:
>>
>> so I've tried several queries but in vain. I would like to do
>> something
> like
>> that :
>>
>> #set($query="where spaces='MySpace'")
>> #set($results = $xwiki.searchDocuments($query, 5, 0))
>> #foreach ($item in $results)
>> * $item <br/>
>> #end
>>
>> Any idea ?
>>
>
> Hi,
>
> You can try this :
>
> #set($query="where doc.web='Main'")
> #set($results = $xwiki.searchDocuments($query, 5, 0))
> #foreach ($item in $results)
> * $item <br/>
> #end
>
> Other examples are available here :
>
http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>