Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Store\Sql\TermSqlIndexBuilder Class Reference

(Re)builds term index in the SQL table. More...

Public Member Functions

 __construct (ILBFactory $loadBalancerFactory, TermSqlIndex $termSqlIndex, SqlEntityIdPagerFactory $entityIdPagerFactory, EntityRevisionLookup $entityRevisionLookup, array $entityTypes, $sleep=0)
 
 setProgressReporter (MessageReporter $reporter)
 
 setErrorReporter (MessageReporter $reporter)
 
 setBatchSize ( $size)
 
 rebuild ()
 
 setFromId ( $fromId)
 
 setRebuildAllEntityTerms ( $rebuildAllEntityTerms)
 Enables or disables the complete rebuilding of entity terms, i.e.
 
 setRemoveDuplicateTerms ( $removeDuplicateTerms)
 Enables or disables checking if the index contains duplicate terms for the particular entity, and removing duplicates if found any.
 

Public Attributes

const TABLE_NAME = 'wb_terms'
 

Private Member Functions

 rebuildForEntityType ( $entityType)
 
 rebuildTermsForBatch (array $entityIds, ILoadBalancer $loadBalancer, $transactionTicket)
 
 rebuildEntityTerms (IDatabase $dbr, IDatabase $dbw, EntityId $entityId)
 
 rebuildAllTermsOfEntity (EntityId $entityId)
 
 getDuplicateTerms (array $terms)
 

Private Attributes

 $loadBalancerFactory
 
 $termSqlIndex
 
 $entityIdPagerFactory
 
 $entityRevisionLookup
 
 $entityTypes
 
 $sleep
 
 $progressReporter
 
 $errorReporter
 
 $batchSize = 1000
 
 $removeDuplicateTerms = false
 
 $rebuildAllEntityTerms = false
 
 $fromId = null
 

Detailed Description

(Re)builds term index in the SQL table.

This can add missing information to the SQL table like missing full entity ID. It also removes possible duplicate terms. It can also ensure that all expected entity terms are stored in the term index, i.e. add all possible missing terms of the given entity, and remove all possible no longer valid terms of the entity, even if there is no other need for rebuilding the index (i.e. all ID fields are populated, there are no duplicate entries).

Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::__construct ( ILBFactory  $loadBalancerFactory,
TermSqlIndex  $termSqlIndex,
SqlEntityIdPagerFactory  $entityIdPagerFactory,
EntityRevisionLookup  $entityRevisionLookup,
array  $entityTypes,
  $sleep = 0 
)
Parameters
ILBFactory$loadBalancerFactory
TermSqlIndex$termSqlIndex
SqlEntityIdPagerFactory$entityIdPagerFactory
EntityRevisionLookup$entityRevisionLookup
string[]$entityTypes
int$sleepSleep time between each batch

Member Function Documentation

◆ getDuplicateTerms()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::getDuplicateTerms ( array  $terms)
private
Parameters
TermIndexEntry[]$terms
Returns
TermIndexEntry[]

◆ rebuild()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::rebuild ( )

◆ rebuildAllTermsOfEntity()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::rebuildAllTermsOfEntity ( EntityId  $entityId)
private

◆ rebuildEntityTerms()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::rebuildEntityTerms ( IDatabase  $dbr,
IDatabase  $dbw,
EntityId  $entityId 
)
private

◆ rebuildForEntityType()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::rebuildForEntityType (   $entityType)
private
Parameters
string$entityType

◆ rebuildTermsForBatch()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::rebuildTermsForBatch ( array  $entityIds,
ILoadBalancer  $loadBalancer,
  $transactionTicket 
)
private
Parameters
EntityId[]$entityIds
ILoadBalancer$loadBalancer
mixed$transactionTicket

◆ setBatchSize()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setBatchSize (   $size)
Parameters
int$size

◆ setErrorReporter()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setErrorReporter ( MessageReporter  $reporter)

◆ setFromId()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setFromId (   $fromId)
Parameters
int$fromId

◆ setProgressReporter()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setProgressReporter ( MessageReporter  $reporter)

◆ setRebuildAllEntityTerms()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setRebuildAllEntityTerms (   $rebuildAllEntityTerms)

Enables or disables the complete rebuilding of entity terms, i.e.

removing all existing terms of the entity, and adding its terms to the index again.

Parameters
bool$rebuildAllEntityTerms

◆ setRemoveDuplicateTerms()

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::setRemoveDuplicateTerms (   $removeDuplicateTerms)

Enables or disables checking if the index contains duplicate terms for the particular entity, and removing duplicates if found any.

Note this setting is redundant if the complete rebuild of the entity term index is enabled.

Parameters
bool$removeDuplicateTerms

Member Data Documentation

◆ $batchSize

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$batchSize = 1000
private

◆ $entityIdPagerFactory

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$entityIdPagerFactory
private

◆ $entityRevisionLookup

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$entityRevisionLookup
private

◆ $entityTypes

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$entityTypes
private

◆ $errorReporter

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$errorReporter
private

◆ $fromId

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$fromId = null
private

◆ $loadBalancerFactory

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$loadBalancerFactory
private

◆ $progressReporter

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$progressReporter
private

◆ $rebuildAllEntityTerms

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$rebuildAllEntityTerms = false
private

◆ $removeDuplicateTerms

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$removeDuplicateTerms = false
private

◆ $sleep

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$sleep
private

◆ $termSqlIndex

Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::$termSqlIndex
private

◆ TABLE_NAME

const Wikibase\Repo\Store\Sql\TermSqlIndexBuilder::TABLE_NAME = 'wb_terms'

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