<?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
<web>Main</web>
<name>WebSearch</name>
<language></language>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<parent></parent>
<creator></creator>
<author>XWiki.superadmin</author>
<contentAuthor></contentAuthor>
<creationDate>1107712020000</creationDate>
<date>1128080847000</date>
<contentUpdateDate>1283762857469</contentUpdateDate>
<version>1.6</version>
<title></title>
<template></template>
<content>1 Search on ObjectWeb Website

#set($formatDate = "MMMM dd, yyyy HH:mm")
#if ($request.getParameter("text"))
#set ($text = $request.getParameter("text") )
#else
#set($text = "")
#end

&lt;center&gt;
&lt;form action="WebSearch"&gt;
&lt;input type="text" name="text" value="$!text"&gt;&amp;nbsp;&lt;input type="submit" name="search" value="Search"&gt;
&lt;/form&gt;
&lt;/center&gt;

#if($text!="")
#set ($sql = "where doc.web like '%$text%' or doc.name like '%$text%' or doc.content like '%$text%' order by doc.date desc")
#set ($start = 0)
#set ($nb = 50)
&lt;!-- 
Sql: $sql
Sql: $start
Sql: $nb
--&gt;

1.1 Search in documents

#foreach ($item in $xwiki.searchDocuments($sql , $nb , $start))
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
   * [$bentrydoc.name&gt;${bentrydoc.web}.$bentrydoc.name] by $xwiki.getLocalUserName($bentrydoc.author) on $xwiki.formatDate($bentrydoc.date, $formatDate)
#end
#end

----

1.1 Search in text fields

#set($sql= ", BaseObject as obj, StringProperty as prop where obj.name=doc.fullName and prop.id.id = obj.id and prop.value like '%$text%'")
#foreach ( $item in $xwiki.searchDocuments($sql , $nb , $start))
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
   * [$bentrydoc.name&gt;${bentrydoc.web}.$bentrydoc.name] by $xwiki.getLocalUserName($bentrydoc.author) on $xwiki.formatDate($bentrydoc.date, $formatDate)
#end
#end

----

1.1 Search in big text fields

#set($sql= ", BaseObject as obj, LargeStringProperty as prop where obj.name=doc.fullName and prop.id.id = obj.id and prop.value like '%$text%'")
#foreach ( $item in $xwiki.searchDocuments($sql , $nb , $start))
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
   * [$bentrydoc.name&gt;${bentrydoc.web}.$bentrydoc.name] by $xwiki.getLocalUserName($bentrydoc.author) on $xwiki.formatDate($bentrydoc.date, $formatDate)
#end
#end

----

1.1 Search in attachment file names

#set($sql= ", XWikiAttachment attach where doc.id = attach.docId and attach.filename like '%$text%' ")
#foreach ( $item in $xwiki.searchDocuments($sql , $nb , $start))
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
   * [$bentrydoc.name&gt;${bentrydoc.web}.$bentrydoc.name] by $xwiki.getLocalUserName($bentrydoc.author) on $xwiki.formatDate($bentrydoc.date, $formatDate)
#end
#end


----

1.1 Search in attachment file content

#set($sql= ", XWikiAttachment attach, XWikiAttachmentContent as attachc where doc.id = attach.docId and attach.id = attachc.id and attachc.content like '%$text%' ")
#foreach ( $item in $xwiki.searchDocuments($sql , $nb , $start))
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
   * [$bentrydoc.name&gt;${bentrydoc.web}.$bentrydoc.name] by $xwiki.getLocalUserName($bentrydoc.author) on $xwiki.formatDate($bentrydoc.date, $formatDate)
#end
#end
#end</content>
<renderedcontent>&lt;h2 class="heading-1"&gt;&lt;span id="HSearchonObjectWebWebsite"&gt;Search on ObjectWeb Website&lt;/span&gt;&lt;/h2&gt;&lt;p class="paragraph"/&gt;
&lt;center&gt;
&lt;form action="WebSearch"&gt;
&lt;input type="text" name="text" value=""&gt;&amp;nbsp;&lt;input type="submit" name="search" value="Search"&gt;
&lt;/form&gt;
&lt;/center&gt;&lt;p class="paragraph"/&gt;
</renderedcontent>
</xwikidoc>