Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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 (RepoDomainDb $repoDb, TypeIdsAcquirer $typeIdsAcquirer, TypeIdsResolver $typeIdsResolver, EntityIdComposer $entityIdComposer, LoggerInterface $logger)
 
 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[]

 

Private Member Functions

 criteriaToQueryResults (IReadableDatabase $dbr, array $criteria, $termType=null, $entityType=null, array $options=[])
 
 getTermMatchQueries (IReadableDatabase $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.
 
 getEntityId (object $termRow)
 
 getDbr ()
 

Private Attributes

RepoDomainDb $repoDb
 
LoggerInterface $logger
 
TypeIdsAcquirer $typeIdsAcquirer
 
TypeIdsResolver $typeIdsResolver
 
EntityIdComposer $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 ( RepoDomainDb $repoDb,
TypeIdsAcquirer $typeIdsAcquirer,
TypeIdsResolver $typeIdsResolver,
EntityIdComposer $entityIdComposer,
LoggerInterface $logger )

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 ( IReadableDatabase $dbr,
array $criteria,
$termType = null,
$entityType = null,
array $options = [] )
private
Parameters
IReadableDatabase$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 ( object $termRow)
private

◆ 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 ( IReadableDatabase $dbr,
TermIndexSearchCriteria $mask,
string $entityType,
$termType = null,
array $options = [] )
private
Parameters
IReadableDatabase$dbrUsed for query construction and selects
TermIndexSearchCriteria$mask
string$entityType
string | string[] | null$termType
array$options
Returns
IResultWrapper

Member Data Documentation

◆ $entityIdComposer

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

◆ $logger

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

◆ $repoDb

RepoDomainDb Wikibase\Lib\Store\Sql\Terms\DatabaseMatchingTermsLookup::$repoDb
private

◆ $typeIdsAcquirer

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

◆ $typeIdsResolver

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

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