Actions générales :
Connexion
Inscription
Accueil ▼: Annuaire des Wikis
»
Espace: XWiki
»
Page: SearchCode
default
Actions relatives à la page :
Exporter ▼: Exporter en PDF Exporter en RTF Exporter en HTML
Plus d'actions ▼: Prévisualisation Voir le code source
Welcome to bytebang » SearchCode

# Code source wiki de SearchCode

Modifié par Administrator le 2014/06/29 19:29
Pièces Jointes (0) · Pages liées
Masquer les numéros de lignes 1: {{velocity output="false"}} 2: #set ($searchConfigDoc = $xwiki.getDocument('XWiki.SearchConfig')) 3: #set ($searchConfigClass = $xwiki.getDocument('XWiki.SearchConfigClass').xWikiClass) 4: 5: ## Get or create the configuration object 6: #set ($searchConfigObj = $searchConfigDoc.getObject($searchConfigClass.name, true)) 7: #set ($searchEngine = "$!{searchConfigObj.getProperty('engine').value}") 8: 9: ## Default search engine to use in case the configured one is not found: 10: ## - 'solr' is the preferred default 11: ## - 'database' is the fall-back default 12: #set ($searchExtensions = $services.uix.getExtensions('org.xwiki.platform.search', {'sortByCustomOrder' : "${searchEngine}, solr, database"})) 13: #if (!$searchExtensions.isEmpty()) 14: #set ($searchExtension = $searchExtensions[0]) 15: 16: ## Update the configuration if it is out of synch with the reality (installed extensions). 17: #set ($needsUpdate = $searchEngine != $searchExtension.id) 18: #set ($searchEngine = $searchExtension.id) 19: #if ($needsUpdate && $searchConfigDoc.hasAccessLevel('edit')) 20: #if ($searchConfigDoc.parent == '') 21: $searchConfigDoc.setParent('XWiki.SearchAdmin') 22: #end 23: ## Save the updated configuration. Make sure to set it hidden as it's a technical document. 24: $searchConfigObj.set('engine', $searchEngine) 25: $searchConfigDoc.setHidden(true) 26: $searchConfigDoc.save() 27: #end 28: 29: #set ($searchPage = $searchExtension.parameters.search) 30: #set ($searchAdminPage = $searchExtension.parameters.admin) 31: #else 32: ## No Search UI Extension was found! 33: #set ($searchPage = '') 34: #set ($searchAdminPage = '') 35: #end 36: {{/velocity}}

(c) 2026, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-