Allgemeine Aktionen:
Anmelden
Registrieren
Start ▼: Wiki Verzeichnis
»
Bereich: XWiki
»
Seite: SearchCode
default
Aktionen:
Exportieren ▼: Als PDF exportieren Als RTF exportieren Als HTML exportieren
Weitere Aktionen ▼: Druckvorschau Zeige den Quellcode
Willkommen bei bytebang » SearchCode

# Wiki-Quellcode von SearchCode

Zuletzt geändert von Administrator am 2014/06/29 19:29
Anhänge (0) · Information
Zeilennummern verstecken 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) 2025, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-