Documentation scripts and queries

Version 2.1 by Eleni Cojocariu on 2026/09/24 17:20

Warning

Technical page. It holds the definitions and the queries used to follow the documentation migration, not documentation itself.

Legacy documentation pages are being replaced, bit by bit, by pages under documentation.. Two pieces of metadata record that on the legacy page:

  • an object saying where its content went
  • a fullyMigrated tag saying the move is finished

This page holds both definitions, the sheet that renders the first one, and the queries that count them.

The mapping object

XClass

Page: XWikiOrg.documentation-scripts-queries.MigratedPageClass (terminal page)

PropertyTypeSettings
newPagesTextAreaEditor: Text, Content: Pure text, 5 rows

One reference per line, no link syntax:

documentation.admin.imports.WebHome
documentation.admin.imports.import-a-xar.WebHome

References to another wiki carry the wiki prefix, e.g. xwiki:documentation.admin.imports.WebHome when the legacy page lives on extensions.xwiki.org.

Sheet

Page: XWikiOrg.documentation-scripts-queries.MigratedPageSheet (terminal page)

Bound to the class by an XWiki.ClassSheetBinding object on the class page, with sheet set to the sheet's reference.

Information

A bound sheet is displayed instead of the page content, not on top of it. That is why the sheet ends by rendering the page's own content: without those last lines, every legacy page carrying the object would show the box and nothing else.

{{velocity}}
#set ($migrated = $doc.getObject('XWikiOrg.documentation-scripts-queries.MigratedPageClass'))
#if ($migrated)
  #set ($newPages = "$!migrated.getValue('newPages')")
  #set ($targets = [])
  #foreach ($line in $newPages.split('[\r\n]+'))
    #set ($reference = $line.trim())
    #if ($reference != '')
      #set ($discard = $targets.add($reference))
    #end
  #end
  #if (!$targets.isEmpty())
(% class="box infomessage" %)
(((
**This content has moved.** It is now in:

#foreach ($reference in $targets)
#set ($target = $xwiki.getDocument($reference))
#if ($target.isNew())
* $reference (page not found)
#else
* [[$target.plainTitle>>$reference]]
#end
#end
)))
  #end
#end
{{/velocity}}

{{velocity}}
#if ("$!doc.content" != '')
{{html clean="false"}}$doc.getRenderedContent(){{/html}}
#end
{{/velocity}}

The tag

A legacy page whose content has been entirely moved gets the tag fullyMigrated. The object can be filled in earlier and grow as replacements appear; the tag is what says the move is over, and it is what the progress number counts.

The spelling matters: tags are free text, so fullymigrated or done simply do not count.

Queries

Solr queries, run on the wiki that holds the pages.

How many pages are left in a legacy tree (www)

All the pages of the tree:

type:DOCUMENT AND space_prefix:"Documentation.UserGuide" AND -name:WebPreferences

The ones that are done:

type:DOCUMENT AND space_prefix:"Documentation.UserGuide" AND property.XWiki.TagClass.tags:fullyMigrated

Started but not finished - the page says where its content went, but is not marked done:

type:DOCUMENT AND space_prefix:"Documentation.UserGuide" AND class:"XWikiOrg.documentation-scripts-queries.MigratedPageClass" AND -property.XWiki.TagClass.tags:fullyMigrated

Replace Documentation.UserGuide by Documentation.AdminGuide or Documentation.DevGuide for the other trees.

Converted extension pages (extensions.xwiki.org)

Extension pages need nothing added: the website field already points into the new tree once the page has been converted.

type:DOCUMENT AND property.ExtensionCode.ExtensionClass.website:*view/documentation*

Object properties are indexed as property.Space.Class.field, which is what makes all of the above single queries.

Get Connected