CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Sanity\Checker Class Reference

Checks if a WikiPage's representation in search index is sane. More...

Public Member Functions

 __construct (SearchConfig $config, Connection $connection, Remediator $remediator, Searcher $searcher, StatsFactory $statsFactory, $logSane, $fastRedirectCheck, ?ArrayObject $pageCache=null, ?callable $isOldFn=null)
 Build the checker.
 
 check (array $pageIds)
 Check if a title is insane.
 

Static Public Member Functions

static makeIsOldClosure ( $loopId, $numCycles)
 Decide if a document should be reindexed based on time since last reindex.
 

Detailed Description

Checks if a WikiPage's representation in search index is sane.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Sanity\Checker::__construct ( SearchConfig $config,
Connection $connection,
Remediator $remediator,
Searcher $searcher,
StatsFactory $statsFactory,
$logSane,
$fastRedirectCheck,
?ArrayObject $pageCache = null,
?callable $isOldFn = null )

Build the checker.

Parameters
SearchConfig$config
Connection$connection
Remediator$remediatorthe remediator to which to send titles that are insane
Searcher$searchersearcher to use for fetches
StatsFactory$statsFactoryto use for recording metrics
bool$logSaneshould we log sane ids
bool$fastRedirectCheckfast but inconsistent redirect check
ArrayObject | null$pageCachecache for WikiPage loaded from db
callable | null$isOldFnAccepts a WikiPage argument and returns boolean true if the page should be reindexed based on time since last reindex.

Member Function Documentation

◆ check()

CirrusSearch\Sanity\Checker::check ( array $pageIds)

Check if a title is insane.

Parameters
int[]$pageIdspage to check
Returns
int the number of pages updated
Exceptions
CheckerException

◆ makeIsOldClosure()

static CirrusSearch\Sanity\Checker::makeIsOldClosure ( $loopId,
$numCycles )
static

Decide if a document should be reindexed based on time since last reindex.

Consider a page as old every $numCycles times the saneitizer loops over the same document. This ensures documents have been reindexed within the last $numCycles * actual_loop_duration (note that the configured duration is min_loop_duration, but in practice configuration ensures min and actual are typically the same).

Parameters
int$loopIdThe number of times the checker has looped over the document set.
int$numCyclesThe number of loops after which a document is considered old.
Returns
\Closure

The documentation for this class was generated from the following file: