[[Special:RandomRootPage]] returning pages that are subpages due to overriding from elastic search
Closed, ResolvedPublic

Description

+++ This bug was initially created as a clone of Bug #46420 +++

[[Special:RandomRootPage/]] is reported to be returning subpages on wikibooks


Version: unspecified
Severity: minor

Details

Reference
bz66879
bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz66879.
Bawolff created this task.Jun 20 2014, 2:10 PM
Reedy added a comment.Jun 20 2014, 2:12 PM

From bug 46420

(In reply to Sam Reed (reedy) from comment #5)

I guess the problem is that we're now using ElasticSearch to do the
randomness.

Meaning the SQL query, and as such, the amended SQL query for
Special:RandomRootPage isn't actually run...

Transplanting something like the below into the extension would fix this
issue

	/**
	 * Choose a random title.
	 * @return Title|null Title object (or null if nothing to choose from)
	 */
	public function getRandomTitle() {
		$row = $this->selectRandomPageFromDB( wfRandom() );

		/* If we picked a value that was higher than any in
		 * the DB, wrap around and select the page with the
		 * lowest value instead!  One might think this would
		 * skew the distribution, but in fact it won't cause
		 * any more bias than what the page_random scheme
		 * causes anyway.  Trust me, I'm a mathematician. :)
		 */
		if ( !$row ) {
			$row = $this->selectRandomPageFromDB( "0" );
		}

		if ( $row ) {
			return Title::makeTitleSafe( $row->page_namespace, $row->page_title );
		}

		return null;
	}

Change 140915 had a related patch set uploaded by Brian Wolff:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/140915

Change 140915 merged by jenkins-bot:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/140915

(In reply to Gerrit Notification Bot from comment #3)

Change 140915 merged by jenkins-bot:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/140915

This should appear on wikibooks come July 1.

Change 141697 had a related patch set uploaded by Chad:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/141697

Change 141697 merged by jenkins-bot:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/141697

Change 141698 had a related patch set uploaded by Chad:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/141698

Change 141698 merged by jenkins-bot:
Don't override Special:Random if $extra is set

https://gerrit.wikimedia.org/r/141698

All patches merged into the codebase; closing again as fixed.

Change 144267 had a related patch set uploaded by Siebrand:
Add message documentation for newly added messages

https://gerrit.wikimedia.org/r/144267

(In reply to Gerrit Notification Bot from comment #10)

Change 144267 had a related patch set uploaded by Siebrand:
Add message documentation for newly added messages

https://gerrit.wikimedia.org/r/144267

This patch is unrelated as far as I can tell.

Change 144267 had a related patch set uploaded by Brian Wolff:
Add message documentation for newly added messages

https://gerrit.wikimedia.org/r/144267