[xwiki-users] Displaying the pages of a space
Hi, I want to display all the pages of a specific space. For that I found the following code : #set($docs = $xwiki.getSpaceDocsName('MySpace')) #foreach ($doc in $docs) [${doc}] #end It works fine but I need more than that (ordering, exclusion...). So I'm trying to find the same fonctionnality but with a query. I couldn't find anything at http://dev.xwiki.org/xwiki/bin/view/Design/XWiki+Query+Language+Specificatio... 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 ? Thanks, Antonio
On Thu, May 15, 2008 at 6:33 PM, Antonio Goncalves <[email protected]> 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 -- Jean-Vincent Drean
Thanks Jean-Vincent it works. Two more questions. 1) On the API ( http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3...) 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 ? 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 ? Thanks, Antonio 2008/5/15, Jean-Vincent Drean <[email protected]>:
On Thu, May 15, 2008 at 6:33 PM, Antonio Goncalves <[email protected]> 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
-- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Antonio Goncalves ([email protected]) Software architect Paris JUG leader : www.parisjug.org Web site : www.antoniogoncalves.org Blog: jroller.com/agoncal LinkedIn: www.linkedin.com/in/agoncal
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.3...) 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 <[email protected]>:
On Thu, May 15, 2008 at 6:33 PM, Antonio Goncalves <[email protected]> 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
See below Antonio 2008/5/15 Vincent Massol <[email protected]>:
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 (
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.
Ok. I really thought both things were related. I though doc was just an instance of the Document class.
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.
One thing that really would help is to be able to search for code. If you go to code.xwiki.org and search for the string "getDocument" no result is found.
Thanks -Vincent
2008/5/15, Jean-Vincent Drean <[email protected]>:
On Thu, May 15, 2008 at 6:33 PM, Antonio Goncalves <[email protected]> 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
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Antonio Goncalves ([email protected]) Software architect Paris JUG leader : www.parisjug.org Web site : www.antoniogoncalves.org Blog: jroller.com/agoncal LinkedIn: www.linkedin.com/in/agoncal
On May 16, 2008, at 2:48 PM, Antonio Goncalves wrote: [snip]
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.
One thing that really would help is to be able to search for code. If you go to code.xwiki.org and search for the string "getDocument" no result is found.
This is a very good point and actually I was pretty sure this was working. Just tested it and it doesn't work, not sure why since the whole document should be indexed, including macro contents. Maybe someone with more knowledge of the lucene plugin knows why. I've opened this issue: http://jira.xwiki.org/jira/browse/XPLUCENE-16 Thanks -Vincent
Vincent Massol wrote:
On May 16, 2008, at 2:48 PM, Antonio Goncalves wrote:
[snip]
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. One thing that really would help is to be able to search for code. If you go to code.xwiki.org and search for the string "getDocument" no result is found.
This is a very good point and actually I was pretty sure this was working. Just tested it and it doesn't work, not sure why since the whole document should be indexed, including macro contents.
Maybe someone with more knowledge of the lucene plugin knows why.
I've opened this issue: http://jira.xwiki.org/jira/browse/XPLUCENE-16
Are you sure it's not another instance of http://jira.xwiki.org/jira/browse/XE-235 ? -- Sergiu Dumitriu http://purl.org/net/sergiu/
On May 16, 2008, at 3:51 PM, Sergiu Dumitriu wrote:
Vincent Massol wrote:
On May 16, 2008, at 2:48 PM, Antonio Goncalves wrote:
[snip]
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. One thing that really would help is to be able to search for code. If you go to code.xwiki.org and search for the string "getDocument" no result is found.
This is a very good point and actually I was pretty sure this was working. Just tested it and it doesn't work, not sure why since the whole document should be indexed, including macro contents.
Maybe someone with more knowledge of the lucene plugin knows why.
I've opened this issue: http://jira.xwiki.org/jira/browse/XPLUCENE-16
Are you sure it's not another instance of http://jira.xwiki.org/jira/browse/XE-235 ?
yes. I tried with an Admin user on xwiki.org and I got no results. -Vincent
participants (4)
-
Antonio Goncalves -
Jean-Vincent Drean -
Sergiu Dumitriu -
Vincent Massol