Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup Class Reference

MatchingTermsLookup implementation in the new term store. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup:

Public Member Functions

 __construct (ILoadBalancer $lb, TypeIdsAcquirer $typeIdsAcquirer, TypeIdsResolver $typeIdsResolver, EntityIdComposer $entityIdComposer, LoggerInterface $logger, $databaseDomain=false)
 
 getMatchingTerms (array $criteria, $termType=null, $entityType=null, array $options=[])
 Returns the terms that match the provided conditions.$terms is an array of Term objects. Terms are joined by OR. The fields of the terms are joined by AND.A default can be provided for termType and entityType via the corresponding method parameters.
Parameters
TermIndexSearchCriteria[]$criteria
string | string[] | null$termType
string | string[] | null$entityType
array$optionsAccepted options are:
  • caseSensitive: boolean, default true
  • prefixSearch: boolean, default false
  • LIMIT: int, defaults to none
  • orderByWeight: boolean, default false
Returns
TermIndexEntry[]
More...
 

Private Member Functions

 criteriaToQueryResults (IDatabase $dbr, array $criteria, $termType=null, $entityType=null, array $options=[])
 
 getTermMatchQueries (IDatabase $dbr, TermIndexSearchCriteria $mask, string $entityType, $termType=null, array $options=[])
 
 buildTermResult (array $results, ?int $limit=null)
 Modifies the provided terms to use the field names expected by the interface rather then the table field names. More...
 
 getEntityId ( $termRow)
 
 getDbr ()
 

Private Attributes

 $lb
 
 $databaseDomain
 
 $logger
 
 $typeIdsAcquirer
 
 $typeIdsResolver
 
 $entityIdComposer
 

Detailed Description

MatchingTermsLookup implementation in the new term store.

Mostly used for search.

See also
Item & Property Terms

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::__construct ( ILoadBalancer  $lb,
TypeIdsAcquirer  $typeIdsAcquirer,
TypeIdsResolver  $typeIdsResolver,
EntityIdComposer  $entityIdComposer,
LoggerInterface  $logger,
  $databaseDomain = false 
)

Member Function Documentation

◆ buildTermResult()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::buildTermResult ( array  $results,
?int  $limit = null 
)
private

Modifies the provided terms to use the field names expected by the interface rather then the table field names.

Also ensures the values are of the correct type.

Parameters
IResultWrapper[]$results
int | null$limit
Returns
TermIndexEntry[]

◆ criteriaToQueryResults()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::criteriaToQueryResults ( IDatabase  $dbr,
array  $criteria,
  $termType = null,
  $entityType = null,
array  $options = [] 
)
private
Parameters
IDatabase$dbrUsed for query construction and selects
TermIndexSearchCriteria[]$criteria
string | string[] | null$termType
string | string[] | null$entityType
array$options
Returns
IResultWrapper[]

◆ getDbr()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::getDbr ( )
private

◆ getEntityId()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::getEntityId (   $termRow)
private
Parameters
object$termRow
Returns
EntityId|null

◆ getMatchingTerms()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::getMatchingTerms ( array  $criteria,
  $termType = null,
  $entityType = null,
array  $options = [] 
)

Returns the terms that match the provided conditions.$terms is an array of Term objects. Terms are joined by OR. The fields of the terms are joined by AND.A default can be provided for termType and entityType via the corresponding method parameters.

Parameters
TermIndexSearchCriteria[]$criteria
string | string[] | null$termType
string | string[] | null$entityType
array$optionsAccepted options are:
  • caseSensitive: boolean, default true
  • prefixSearch: boolean, default false
  • LIMIT: int, defaults to none
  • orderByWeight: boolean, default false
Returns
TermIndexEntry[]

Implements Wikibase\Lib\Store\MatchingTermsLookup.

◆ getTermMatchQueries()

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::getTermMatchQueries ( IDatabase  $dbr,
TermIndexSearchCriteria  $mask,
string  $entityType,
  $termType = null,
array  $options = [] 
)
private
Parameters
IDatabase$dbrUsed for query construction and selects
TermIndexSearchCriteria$mask
string$entityType
string | string[] | null$termType
array$options
Returns
IResultWrapper

Member Data Documentation

◆ $databaseDomain

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$databaseDomain
private

◆ $entityIdComposer

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$entityIdComposer
private

◆ $lb

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$lb
private

◆ $logger

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$logger
private

◆ $typeIdsAcquirer

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$typeIdsAcquirer
private

◆ $typeIdsResolver

Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$typeIdsResolver
private

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