General Actions:
Log-in
Wiki:
L3D's Wiki
▼
:
Document Index
»
Space:
XWiki
▼
:
Document Index
»
Page:
LuceneSearchAdmin
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to your wiki
»
Search administration
»
Lucene search administration
Wiki source code of
Lucene search administration
Last modified by
Administrator
on 2011/03/02 17:34
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity output="false"}} 2: #set ($lucene = $xwiki.lucene) 3: {{/velocity}} 4: 5: {{velocity}} 6: #if ($hasAdmin) 7: #if ($request.action == 'indexfarm') 8: #if ($xcontext.isMainWiki()) 9: #set ($clearIndex = true) 10: #set ($onlyNew = false) 11: #set ($startindex = true) 12: #else## !$xcontext.isMainWiki() 13: {{error}}$msg.get('needadminrights').{{/error}} 14: #end 15: #elseif ($request.action == 'indexcurrentwiki') 16: #set ($wikis = [$xcontext.database]) 17: #set ($wikisString = "${xcontext.database}") 18: #set ($clearIndex = true) 19: #set ($onlyNew = false) 20: #set ($startindex = true) 21: #elseif ($request.action == 'indexcustom') 22: #if ($xcontext.isMainWiki()) 23: #if ("$!{request.wikis.trim()}" != '') 24: #set ($wikisArray = $request.wikis.split(',')) 25: #set ($wikis = $wikisArray.subList(0, $wikisArray.size())) 26: #set ($wikisString = $request.wikis) 27: #end 28: #else## !$xcontext.isMainWiki() 29: #set ($wikis = [$xcontext.database]) 30: #set ($wikisString = "${xcontext.database}") 31: #end 32: #set ($hqlFilter = $request.hqlFilter) 33: #set ($clearIndex = $request.clearIndex == 'on') 34: #set ($onlyNew = $request.onlyNew == 'on') 35: #set ($startindex = true) 36: #end 37: ## 38: #if ($startindex) 39: #set ($errorcode = $lucene.startIndex($wikis, $hqlFilter, $clearIndex, $onlyNew)) 40: #if ($errorcode > 0) 41: {{info}}$msg.get('search.admin.lucene.indexing.message.started'){{/info}} 42: #elseif ($errorcode == -1) 43: {{error}}$msg.get('needadminrights').{{/error}} 44: #elseif ($errorcode == -2) 45: {{warning}}$msg.get('search.admin.lucene.indexing.message.alreadystarted'){{/warning}} 46: #end 47: #end 48: #else## !hasAdmin 49: {{error}}$msg.get('needadminrights').{{/error}} 50: #end## hasAdmin 51: {{/velocity}} 52: 53: (% id="Hsearch.admin.lucene.status.title" %) 54: == {{velocity}}$msg.get('search.admin.lucene.status.title'){{/velocity}} == 55: 56: {{velocity}} 57: |=$msg.get('search.admin.lucene.status.infotitle')|=$msg.get('search.admin.lucene.status.valuetitle') 58: |$msg.get('search.admin.lucene.status.indexed')|$lucene.luceneDocCount 59: |$msg.get('search.admin.lucene.status.indexing')|$lucene.queueSize 60: {{/velocity}} 61: 62: (% id="Hsearch.admin.lucene.indexing.title" %) 63: == {{velocity}}$msg.get('search.admin.lucene.indexing.title'){{/velocity}} == 64: 65: {{velocity}}$msg.get('search.admin.lucene.indexing.description'){{/velocity}} 66: 67: {{velocity}} 68: #if ($hasAdmin) 69: {{html}} 70: <form action="$xwiki.requestURL" enctype="multipart/form-data" method="post"> 71: <fieldset> 72: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 73: 74: ## Does not really make sense to reindex the whole farm from a subwiki 75: #if ($xcontext.isMainWiki()) 76: <p> 77: <label for="indexfarm"><input id="indexfarm" name="action" type="radio" value="indexfarm" #if (!$request.action || $request.action == 'indexfarm')checked="checked" #end/> $msg.get('search.admin.lucene.indexing.action.indexfarm')</label> 78: </p> 79: #end 80: 81: <p> 82: <label for="indexcurrentwiki"><input id="indexcurrentwiki" name="action" type="radio" value="indexcurrentwiki" #if((!$xcontext.isMainWiki() && !$request.action) || $request.action == 'indexcurrentwiki'))checked="checked" #end/> $msg.get('search.admin.lucene.indexing.action.indexcurrentwiki')</label> 83: </p> 84: 85: ## Needs programming right because it takes a custom HQL query which could be dangerous 86: <p> 87: <label for="indexcustom"><input id="indexcustom" name="action" type="radio" value="indexcustom" #if ($request.action == 'indexcustom')checked="checked" #end/> $msg.get('search.admin.lucene.indexing.action.indexcustom')</label> 88: </p> 89: 90: <p> 91: #if ($xcontext.isMainWiki()) 92: <label for="indexcustom_wikis">$msg.get('search.admin.lucene.indexing.action.indexcustom.wikis')</label> <input id="indexcustom_wikis" name="wikis" type="text" title="$escapetool.xml($msg.get('search.admin.lucene.indexing.action.indexcustom.wikis.title'))" value="$!wikisString" /> 93: #else 94: <input id="indexcustom_wikis" name="wikis" value="${xcontext.database}" type="hidden" value="$!wikisString" /> 95: #end 96: </p> 97: 98: #if ($hasProgramming && $xcontext.isMainWiki()) 99: <p> 100: <label for="indexcustom_hqlFilter">$msg.get('search.admin.lucene.indexing.action.indexcustom.hqlfilter')</label> <input id="indexcustom_hqlFilter" name="hqlFilter" type="text" title="$escapetool.xml($msg.get('search.admin.lucene.indexing.action.indexcustom.hqlfilter.title'))" #if($request.hqlFilter)value="${escapetool.xml($request.hqlFilter)}"#end /> 101: </p> 102: #end 103: 104: <p> 105: <label for="indexcustom_clearIndex"><input id="indexcustom_clearIndex" name="clearIndex" type="checkbox" title="$escapetool.xml($msg.get('search.admin.lucene.indexing.action.indexcustom.clearindex.title'))" #if($clearIndex)checked="checked" #end/> $msg.get('search.admin.lucene.indexing.action.indexcustom.clearindex')</label> 106: </p> 107: <p> 108: <label for="indexcustom_onlyNew"><input id="indexcustom_onlyNew" name="onlyNew" type="checkbox" title="$escapetool.xml($msg.get('search.admin.lucene.indexing.action.indexcustom.onlynew.title'))" #if($onlyNew)checked="checked" #end/> $msg.get('search.admin.lucene.indexing.action.indexcustom.onlynew')</label> 109: </p> 110: 111: <span class="buttonwrapper"><input type="submit" value="$msg.get('search.admin.lucene.indexing.button')" class="button"/></span> 112: 113: </fieldset> 114: </form> 115: {{/html}} 116: #else## !$hasAdmin 117: {{error}}$msg.get('needadminrights').{{/error}} 118: #end 119: {{/velocity}}
Quick Links
L3D Calendar
Wiki Dashboard
Document Index
Blog
Sandbox