Wiki source code of WebSearch

Version 1.1 by Administrator on 2007/07/15 10:39

Show last authors
1 1 Search
2
3 #if(!$request.space)
4 #set($space = "All")
5 #else
6 #set($space = $request.space)
7 #end
8
9 #set($spacesText = {})
10 #set($spaces = $xwiki.spaces)
11 #set($ok = $spacesText.put("All","All"))
12 #foreach($space in $spaces)
13 #set($ok = $spacesText.put($space,$space))
14 #end
15
16 #macro(spaceoption $space $selectspace $spacesText)
17 <option value="$spacesText.get($space)" #if($selectspace == $spacesText.get($space))selected="selected"#end>$space</option>
18 #end
19
20 #macro(spaceselect $selectspace $spaces $spacesText)
21 <select name="space">
22 #spaceoption("All" $selectspace $spacesText)
23 #foreach($space in $spaces)
24 #spaceoption($space $selectspace $spacesText)
25 #end
26 </select>
27 #end
28 ##
29 ##
30 #set($text = "$!request.getParameter('text')")
31 #set($utext = $util.encodeURI($text))
32 #if($space == "All")
33 #set($url = $xwiki.getURL("Main.WebSearchRss", "view", "xpage=rdf&amp;text=${utext}" ))
34 #else
35 #set($url = $xwiki.getURL("Main.WebSearchRss", "view", "xpage=rdf&space=$space&text=${utext}"))
36 #end
37
38 <div style="float: right;">
39 <a href="$url"><img src="$xwiki.getSkinFile("icons/black-rss.png")" style="border:0px" alt="rss icon" /></a>
40 </div>
41
42 <form action="">
43 {pre}
44 <div class="centered">
45 Query
46 <input type="text" name="text" value="$xwiki.getFormEncoded($!text)" size="20"/>
47 in space #spaceselect($space $spaces $spacesText) <input type="submit" value="Search"/>
48 </div>
49 {/pre}
50 </form>
51
52 #includeInContext("XWiki.WebSearchCode")
53 #includeInContext("XWiki.Results")
54
55 #info("You can also try the new experimental [Lucene Search>Main.LuceneSearch?text=$!utext]. It adds scoring, searching into attachments and search paging. Please let us know what you think about it.")