[xwiki-devs] searchDocuments exception
I looked at the FAQ example and am trying to write a query to get all of the blog entries for a specific author here is the script: #set ($sql = ", from BaseObject as obj where doc.fullName = obj.name and obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki.GEVERITT'") #set ($start = 0) #set ($nb = 50) #set ($collect = $xwiki.searchDocuments($sql , $nb , $start)) # $collect.size() #foreach ($item in $collect) #if ($xwiki.hasAccessLevel("view", "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) #set($date = $xwiki.formatDate($bentrydoc.date,"MMMM dd, yyyy HH:mm")) #<p>$bentrydoc.name $date</p> #end #end I see this exception Error number 4001 in 4: Error while parsing velocity page COE.Blog_GEVERITT Wrapped Exception: Invocation of method 'searchDocuments' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with SQL web, doc.name from XWiki Document as doc , from Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? Wrapped Exception: unexpected token: from near line 1, column 81 web, doc.name from com.xpn.xwiki.doc.XWiki Document as doc , from com.xpn.xwiki.objects.Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? @ COE.Blog_GEVERITT4,25? and then see this which looks like the query that was executed. What looks odd is that doc.author has the bread crumb trail in it "User Blogs > Blog_GEVERITT" instead of just "GEVERITT" select distinct doc.web, doc.name from XWikiDocument as doc , from BaseObject as obj where doc.fullName = obj.name and obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki: User Blogs > Blog_GEVERITT > GEVERITT' Any idea what the problem is? Any help or suggestions on debugging it would be appreciated. I am using XWiki 1.3.2, Oracle 10, Tomcat 5.5 Thanks Glenn Everitt -- View this message in context: http://www.nabble.com/searchDocuments-exception-tp17339532p17339532.html Sent from the XWiki- Dev mailing list archive at Nabble.com.
On Tue, May 20, 2008 at 2:50 PM, Glenn Everitt <Glenn.Everitt@compuware.com> wrote:
I looked at the FAQ example and am trying to write a query to get all of the blog entries for a specific author here is the script:
#set ($sql = ", from BaseObject as obj where doc.fullName = obj.name and
Remove the ", from" here. As you written in this mail it generate : [...]from XWikiDocument as doc , from BaseObject[...] searchDocument automatically add suffix : "select distinct doc.web, doc.name from XWikiDocument as doc" to the SQL query. I think you copied a code that was used with search in place of searchDocument.
obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki.GEVERITT'") #set ($start = 0) #set ($nb = 50) #set ($collect = $xwiki.searchDocuments($sql , $nb , $start)) # $collect.size() #foreach ($item in $collect) #if ($xwiki.hasAccessLevel("view", "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) #set($date = $xwiki.formatDate($bentrydoc.date,"MMMM dd, yyyy HH:mm")) #<p>$bentrydoc.name $date</p> #end #end
I see this exception
Error number 4001 in 4: Error while parsing velocity page COE.Blog_GEVERITT Wrapped Exception: Invocation of method 'searchDocuments' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with SQL web, doc.name from XWiki Document as doc , from Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? Wrapped Exception: unexpected token: from near line 1, column 81 web, doc.name from com.xpn.xwiki.doc.XWiki Document as doc , from com.xpn.xwiki.objects.Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? @ COE.Blog_GEVERITT4,25?
and then see this which looks like the query that was executed. What looks odd is that doc.author has the bread crumb trail in it "User Blogs > Blog_GEVERITT" instead of just "GEVERITT"
select distinct doc.web, doc.name from XWikiDocument as doc , from BaseObject as obj where doc.fullName = obj.name and obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki: User Blogs > Blog_GEVERITT > GEVERITT'
Any idea what the problem is? Any help or suggestions on debugging it would be appreciated. I am using XWiki 1.3.2, Oracle 10, Tomcat 5.5
Thanks Glenn Everitt -- View this message in context: http://www.nabble.com/searchDocuments-exception-tp17339532p17339532.html Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Tue, May 20, 2008 at 3:06 PM, Thomas Mortagne <thomas.mortagne@xwiki.com> wrote:
On Tue, May 20, 2008 at 2:50 PM, Glenn Everitt <Glenn.Everitt@compuware.com> wrote:
I looked at the FAQ example and am trying to write a query to get all of the blog entries for a specific author here is the script:
#set ($sql = ", from BaseObject as obj where doc.fullName = obj.name and
Remove the ", from" here. As you written in this mail it generate : [...]from XWikiDocument as doc , from BaseObject[...]
Sorry, I mean remove the "from".
searchDocument automatically add suffix : "select distinct doc.web, doc.name from XWikiDocument as doc" to the SQL query. I think you copied a code that was used with search in place of searchDocument.
obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki.GEVERITT'") #set ($start = 0) #set ($nb = 50) #set ($collect = $xwiki.searchDocuments($sql , $nb , $start)) # $collect.size() #foreach ($item in $collect) #if ($xwiki.hasAccessLevel("view", "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) #set($date = $xwiki.formatDate($bentrydoc.date,"MMMM dd, yyyy HH:mm")) #<p>$bentrydoc.name $date</p> #end #end
I see this exception
Error number 4001 in 4: Error while parsing velocity page COE.Blog_GEVERITT Wrapped Exception: Invocation of method 'searchDocuments' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with SQL web, doc.name from XWiki Document as doc , from Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? Wrapped Exception: unexpected token: from near line 1, column 81 web, doc.name from com.xpn.xwiki.doc.XWiki Document as doc , from com.xpn.xwiki.objects.Base Object as obj where doc.full Name = obj.name and obj.class Name = 'XWiki.Article Class' and doc.author = 'XWiki.GEVERITT'? @ COE.Blog_GEVERITT4,25?
and then see this which looks like the query that was executed. What looks odd is that doc.author has the bread crumb trail in it "User Blogs > Blog_GEVERITT" instead of just "GEVERITT"
select distinct doc.web, doc.name from XWikiDocument as doc , from BaseObject as obj where doc.fullName = obj.name and obj.className = 'XWiki.ArticleClass' and doc.author = 'XWiki: User Blogs > Blog_GEVERITT > GEVERITT'
Any idea what the problem is? Any help or suggestions on debugging it would be appreciated. I am using XWiki 1.3.2, Oracle 10, Tomcat 5.5
Thanks Glenn Everitt -- View this message in context: http://www.nabble.com/searchDocuments-exception-tp17339532p17339532.html Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
-- Thomas Mortagne
Thank you, Thank you, Thank you. - the quick answer is appreciated very much. Glenn Everitt -- View this message in context: http://www.nabble.com/searchDocuments-exception-tp17339532p17341018.html Sent from the XWiki- Dev mailing list archive at Nabble.com.
participants (2)
-
Glenn Everitt -
Thomas Mortagne