Extensions Index
Since XWiki 12.10 Extension Manager comes with a local index of available extensions.
It's used by default in the Extension Manager UI when searching for extension to install. Aside from gathering all the extensions availables on the configured searchable repositories (including if they are recommended and their ratings) it also add the following metadata:
- validate each extension on each namespace and store the result, this info is used in the Extesion Manager UI to search by default only compatible extensions for the current namespace (and the root namespace on main wiki)
- XWiki 13.3+ the extension index contains metadata to help filter extensions by components. It's possible to directly filter extension in Extension Manager search UI using the syntax components__org.xwiki.my.package.Role:hint or shortcuts for some well known components roles:
- components__org.xwiki.rendering.macro.Macro -> component_macro
- components__org.xwiki.script.service.ScriptService -> component_scriptservice
- components__org.xwiki.rendering.parser.Parser -> component_parser
- components__org.xwiki.rendering.renderer.PrintRendererFactory -> component_renderer
- components__org.xwiki.rendering.renderer.BlockRenderer -> component_blockrenderer
- components__org.xwiki.filter.input.InputFilterStreamFactory -> component_inputFilter
- components__org.xwiki.filter.output.OutputFilterStreamFactory -> component_outputFilter
The main entry point is the org.xwiki.extension.index.ExtensionIndex component and extensions returned by the index implement the org.xwiki.extension.index.IndexedExtension interface which provide some information specific to the extension stored in the index (like whether or not it's compatible with a specific namespace).
Script API
The main entry point to manipulate the extensions index from a script is the extension.index script service. It mostly a way to acces a safe version of the org.xwiki.extension.index.ExtensionIndex.
#set($extensionQuery = $services.extension.index.newQuery("$!request.search"))
## We want extension starting with an id containing "org.xwiki.contrib"
#set ($discard = $extensionQuery.addFilter('org.xwiki.contrib', '', 'MATCH'))
## We only want extension compatible with current and root namespaces
#set ($discard = $extensionQuery.setCompatible(true, '', "wiki:$xcontext.database"))
## Execute the query
#set ($extensions = $services.extension.index.repository.search($extensionQuery))