Wiki source code of New documentation pages per month
Last modified by Eleni Cojocariu on 2026/11/16 18:01
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | How many pages of the new documentation were created each month, from January 2026 on. [[Contributors per month>>XWikiOrg.documentation-scripts-queries.migration-progress.contributors.WebHome]] takes one month and says who wrote what in it. | ||
| 2 | |||
| 3 | {{cache timeToLive="3600"}} | ||
| 4 | {{velocity}} | ||
| 5 | #* | ||
| 6 | The notes this page used to print above the series, kept here rather than deleted - they are what | ||
| 7 | the numbers mean, and they are the answer to the first question anyone asks about them. | ||
| 8 | |||
| 9 | Pages created before January 2026 are not shown as rows, but they are counted in the running | ||
| 10 | total, so it stays a count of how many documentation pages exist rather than how many were | ||
| 11 | written since the series starts. | ||
| 12 | |||
| 13 | A documentation page here is the same thing it is everywhere else on this dashboard: a page | ||
| 14 | under 'documentation.' carrying a DocApp.Code.DocumentationClass object. Landing pages carry | ||
| 15 | LandingPageClass instead and are not counted, and translations are left out - the index holds | ||
| 16 | one document per locale, and only the original is a page. | ||
| 17 | |||
| 18 | A page that was moved into the new documentation keeps the creation date it had before the move, | ||
| 19 | so it counts in the month it was first created rather than in the month it arrived. That is the | ||
| 20 | right answer for a page written in place and the wrong one for a page converted from the legacy | ||
| 21 | trees, and the index cannot tell the two apart. Read the months as when the page came into | ||
| 22 | existence, not as when the documentation grew. | ||
| 23 | |||
| 24 | Three things about how this is computed, each of which cost a wrong number or a broken page once: | ||
| 25 | |||
| 26 | The counts come from Solr range facets - one query per series, each asking for the per-month | ||
| 27 | counts and for no document at all (rows=0). The page used to fetch up to 5000 documents and | ||
| 28 | bucket them in Velocity on every view, which took about 11 seconds; the three facet queries | ||
| 29 | answer in about 30 milliseconds and gave exactly the same numbers for every month when they were | ||
| 30 | swapped in. 'facet.range.other=before' is what carries the baseline, as one count rather than as | ||
| 31 | months nobody reads. | ||
| 32 | |||
| 33 | A range facet drops a bucket whose count is zero, so a month in which one segment produced | ||
| 34 | nothing is simply absent from that segment's map. The months are filled against the total's key | ||
| 35 | set before anything is computed - without it, May 2026 (no extension page at all) read as null | ||
| 36 | and the page died on the arithmetic. | ||
| 37 | |||
| 38 | The cache macro carries no 'id'. With one, the cache key is that id and nothing else about the | ||
| 39 | content, so the block keeps serving what it first produced however the page is edited - and | ||
| 40 | since a macro that fails inside it is rendered as an error block, that error is what gets cached | ||
| 41 | and served for the whole hour, with the old source quoted in it. Without an id the content is | ||
| 42 | the key, so saving the page invalidates the entry. An id is only needed when the same content | ||
| 43 | must be cached once per request parameter. | ||
| 44 | |||
| 45 | Months are UTC, because that is what Solr buckets on, rather than the server timezone the | ||
| 46 | Velocity version used. The two agreed on every month; a page created within a few hours of | ||
| 47 | midnight UTC on the first of a month is where they could differ. | ||
| 48 | *# | ||
| 49 | #set ($Q = '"') | ||
| 50 | #set ($startMonth = '2026-01') | ||
| 51 | #set ($base = "type:DOCUMENT AND wiki:xwiki AND hidden:false AND space_prefix:${Q}documentation${Q} AND class:${Q}DocApp.Code.DocumentationClass${Q} AND doclocale:${Q}${Q}") | ||
| 52 | #set ($statements = $collectiontool.sortedMap) | ||
| 53 | #set ($discard = $statements.put('1-total', $base)) | ||
| 54 | #set ($discard = $statements.put('2-xs', "${base} AND space_prefix:${Q}documentation.xs${Q}")) | ||
| 55 | #set ($discard = $statements.put('3-extensions', "${base} AND space_prefix:${Q}documentation.extensions${Q}")) | ||
| 56 | #set ($series = {}) | ||
| 57 | #set ($baselines = {}) | ||
| 58 | #foreach ($key in $statements.keySet()) | ||
| 59 | #set ($counts = $collectiontool.sortedMap) | ||
| 60 | #set ($query = $services.query.createQuery($statements.get($key), 'solr')) | ||
| 61 | #set ($discard = $query.bindValue('rows', 0)) | ||
| 62 | #set ($discard = $query.bindValue('facet', 'true')) | ||
| 63 | #set ($discard = $query.bindValue('facet.range', 'creationdate')) | ||
| 64 | #set ($discard = $query.bindValue('facet.range.start', "${startMonth}-01T00:00:00Z")) | ||
| 65 | #set ($discard = $query.bindValue('facet.range.end', 'NOW/MONTH+1MONTH')) | ||
| 66 | #set ($discard = $query.bindValue('facet.range.gap', '+1MONTH')) | ||
| 67 | #set ($discard = $query.bindValue('facet.range.other', 'before')) | ||
| 68 | #foreach ($range in $query.execute().get(0).getFacetRanges()) | ||
| 69 | #set ($discard = $baselines.put($key, $range.getBefore())) | ||
| 70 | #foreach ($bucket in $range.getCounts()) | ||
| 71 | ## '2026-01-01T00:00:00Z' -> '2026-01'. The bucket keys are what order the series, and they sort | ||
| 72 | ## chronologically as strings, so a sorted map needs nothing else to keep the months in order. | ||
| 73 | #set ($discard = $counts.put($bucket.getValue().substring(0, 7), $bucket.getCount())) | ||
| 74 | #end | ||
| 75 | #end | ||
| 76 | #set ($discard = $series.put($key, $counts)) | ||
| 77 | #end | ||
| 78 | #set ($totalByMonth = $series.get('1-total')) | ||
| 79 | #set ($xsByMonth = $series.get('2-xs')) | ||
| 80 | #set ($extByMonth = $series.get('3-extensions')) | ||
| 81 | #set ($baseline = $baselines.get('1-total')) | ||
| 82 | #set ($peak = 0) | ||
| 83 | #foreach ($month in $totalByMonth.keySet()) | ||
| 84 | #if (!$xsByMonth.containsKey($month)) | ||
| 85 | #set ($discard = $xsByMonth.put($month, 0)) | ||
| 86 | #end | ||
| 87 | #if (!$extByMonth.containsKey($month)) | ||
| 88 | #set ($discard = $extByMonth.put($month, 0)) | ||
| 89 | #end | ||
| 90 | #if ($totalByMonth.get($month) > $peak) | ||
| 91 | #set ($peak = $totalByMonth.get($month)) | ||
| 92 | #end | ||
| 93 | #end | ||
| 94 | #set ($cumulative = $baseline) | ||
| 95 | #set ($shown = 0) | ||
| 96 | #set ($shownXs = 0) | ||
| 97 | #set ($shownExt = 0) | ||
| 98 | #set ($shownMonths = $totalByMonth.size()) | ||
| 99 | #if ($baseline > 0) | ||
| 100 | **Before January 2026** - $baseline documentation pages already existed, counted in the running total below. | ||
| 101 | |||
| 102 | #end | ||
| 103 | #foreach ($month in $totalByMonth.keySet()) | ||
| 104 | #set ($monthTotal = $totalByMonth.get($month)) | ||
| 105 | #set ($monthXs = $xsByMonth.get($month)) | ||
| 106 | #set ($monthExt = $extByMonth.get($month)) | ||
| 107 | #set ($cumulative = $cumulative + $monthTotal) | ||
| 108 | #set ($shown = $shown + $monthTotal) | ||
| 109 | #set ($shownXs = $shownXs + $monthXs) | ||
| 110 | #set ($shownExt = $shownExt + $monthExt) | ||
| 111 | ## Scaled to the busiest month rather than to a fixed maximum, so the shape of the series is visible | ||
| 112 | ## whatever its scale. The two segments are the two top-level trees. The classes are the skin's own, | ||
| 113 | ## so the bars follow the color theme rather than carrying colours of their own. | ||
| 114 | #set ($xsPct = (100 * $monthXs) / $peak) | ||
| 115 | #set ($extPct = (100 * $monthExt) / $peak) | ||
| 116 | #set ($other = $monthTotal - $monthXs - $monthExt) | ||
| 117 | #if ($other > 0) | ||
| 118 | #set ($otherText = ", $other elsewhere") | ||
| 119 | #else | ||
| 120 | #set ($otherText = '') | ||
| 121 | #end | ||
| 122 | **$month** - $monthTotal new ($monthXs xs, $monthExt extensions$otherText), $cumulative documentation pages in total at the end of the month | ||
| 123 | |||
| 124 | {{html}}<div class="progress">#if ($xsPct > 0)<div class="progress-bar progress-bar-success" style="width: ${xsPct}%">$monthXs</div>#end#if ($extPct > 0)<div class="progress-bar progress-bar-info" style="width: ${extPct}%">$monthExt</div>#end</div>{{/html}} | ||
| 125 | |||
| 126 | #end | ||
| 127 | **$shown new pages** since January 2026, over $shownMonths months: $shownXs under //documentation.xs// and $shownExt under //documentation.extensions//. The busiest month added $peak. With the $baseline pages created before January 2026, the new documentation holds $cumulative pages. | ||
| 128 | {{/velocity}} | ||
| 129 | {{/cache}} |