cogAllows testing HQL queries
TypeSnippet
Category
Developed by

Jean-Vincent Drean

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

Code

In XWiki Syntax 1.0:

1 HQL Query tester

1.1 xwiki.searchDocuments

<form method="post">
<textarea name="searchDocumentsQuery" rows="4" style="width:90%;">
#if($request.searchDocumentsQuery)$request.searchDocumentsQuery#else where doc.author='XWiki.Admin' #end
</textarea>
<br/>
<input type="submit">
</form>

#if ($request.searchDocumentsQuery)
1.1.1 Results

#set ($results = $xwiki.searchDocuments($request.searchDocumentsQuery.trim()))
#foreach ($result in $results)
* $result
#end
#end

1.1 xwiki.search (privileged API)

<form method="post">
<textarea name="searchQuery" rows="4" style="width:90%;">
#if($request.searchQuery) $request.searchQuery #else select doc.fullName, firstname.value, lastname.value from XWikiDocument doc, BaseObject obj, StringProperty firstname, StringProperty lastname where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and obj.id=firstname.id.id and firstname.id.name='first_name' and lastname.id.name='last_name' and obj.id=lastname.id.id
#end
</textarea>
<br/>
<input type="submit">
</form>

#if ($request.searchQuery)
1.1.1 Results

#set ($results = $xwiki.search($request.searchQuery.trim()))
{table}
#foreach ($result in $results)
#foreach ($item in $result) #if ($velocityCount > 1)|#end $item #end
#end
{table}
#end

Result

hqlquerytester.png

Tags: querying
     

Get Connected