0 Votes

Changes for page SearchScript

Last modified by Ryan C on 2025/05/12 09:03

From version 1.1
edited by Ryan C
on 2025/05/12 09:03
Change comment: There is no comment for this version
To version 2.1
edited by Ryan C
on 2025/05/12 09:03
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,0 +1,17 @@
1 +{{velocity}}
2 +#if ($request.xpage == 'plain' && $request.text)
3 + #set ($query = $escapetool.xml($request.text.toLowerCase()))
4 + #set ($results = $services.query.xwql(
5 + "from doc where lower(doc.fullName) like :pattern order by doc.date desc"
6 + ).bindValue("pattern", "%${query}%").setLimit(10).execute())
7 +
8 + <ul style="margin:0;padding:4px;">
9 + #foreach ($docname in $results)
10 + #set ($doc = $xwiki.getDocument($docname))
11 + <li><a href="$doc.getURL()">$doc.displayTitle</a></li>
12 + #end
13 + </ul>
14 + #stop
15 +#end
16 +{{/velocity}}
17 +

XWiki AI Chat