CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\BuildDocument\Completion\QualityScore Class Reference

Score that tries to reflect the quality of a page. More...

+ Inheritance diagram for CirrusSearch\BuildDocument\Completion\QualityScore:
+ Collaboration diagram for CirrusSearch\BuildDocument\Completion\QualityScore:

Public Member Functions

 __construct ( $boostTemplates=null)
 
 score (array $doc)
 @inheritDoc
 
 scoreNormLog2 ( $value, $norm)
 log2( ( value / norm ) + 1 ) => [0-1]
 
 scoreNorm ( $value, $norm)
 value / norm => [0-1]
 
 boostTemplates (array $doc, $score)
 Modify an existing score based on templates contained by the document.
 
 boost ( $score, $boost)
 Boost the score : boost value lower than 1 will decrease the score boost value set to 1 will keep the score unchanged boost value greater than 1 will increase the score.
 
 getRequiredFields ()
 @inheritDoc
 
 setMaxDocs ( $maxDocs)
 
 explain (array $doc)
 Explain the score.
 

Public Attributes

const INCOMING_LINKS_MAX_DOCS_FACTOR = 0.1
 
const EXTERNAL_LINKS_NORM = 20
 
const PAGE_SIZE_NORM = 50000
 
const HEADING_NORM = 20
 
const REDIRECT_NORM = 30
 
const SCORE_RANGE = 10000000
 

Protected Member Functions

 intermediateScore (array $doc)
 
 intermediateExplain (array $doc)
 
 explainWeight (array $detail, $weight, $allWeights, $valueName)
 

Protected Attributes

 $maxDocs
 

Detailed Description

Score that tries to reflect the quality of a page.

NOTE: Experimental

This score makes the assumption that bigger is better.

Small cities/village which have a high number of incoming links because they link to each others ( see https://en.wikipedia.org/wiki/Villefort,_Loz%C3%A8re ) will be be discounted correctly because others variables are very low.

On the other hand some pages like List will get sometimes a very high but unjustified score.

The boost templates feature might help but it's a System message that is not necessarily configured by wiki admins.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\BuildDocument\Completion\QualityScore::__construct ( $boostTemplates = null)
Parameters
float[] | null$boostTemplatesArray of key values, key is the template name, value the boost factor. Defaults to Util::getDefaultBoostTemplates()

Member Function Documentation

◆ boost()

CirrusSearch\BuildDocument\Completion\QualityScore::boost ( $score,
$boost )

Boost the score : boost value lower than 1 will decrease the score boost value set to 1 will keep the score unchanged boost value greater than 1 will increase the score.

score = 0.5, boost = 0.5 result is 0.375 score = 0.1, boost = 2 result is 0.325

Parameters
float$score
float$boost
Returns
float adjusted score

◆ boostTemplates()

CirrusSearch\BuildDocument\Completion\QualityScore::boostTemplates ( array $doc,
$score )

Modify an existing score based on templates contained by the document.

Parameters
array$docDocument score is generated for
float$scoreCurrent score between 0 and 1
Returns
float Score after boosting templates

◆ explain()

CirrusSearch\BuildDocument\Completion\QualityScore::explain ( array $doc)

Explain the score.

Parameters
array$doc
Returns
array

Implements CirrusSearch\BuildDocument\Completion\SuggestScoringMethod.

Reimplemented in CirrusSearch\BuildDocument\Completion\PQScore.

◆ explainWeight()

CirrusSearch\BuildDocument\Completion\QualityScore::explainWeight ( array $detail,
$weight,
$allWeights,
$valueName )
protected
Parameters
array$detail
float$weight
float$allWeights
string$valueName
Returns
array

◆ getRequiredFields()

CirrusSearch\BuildDocument\Completion\QualityScore::getRequiredFields ( )

◆ intermediateExplain()

CirrusSearch\BuildDocument\Completion\QualityScore::intermediateExplain ( array $doc)
protected
Parameters
array$doc
Returns
array

◆ score()

CirrusSearch\BuildDocument\Completion\QualityScore::score ( array $doc)

◆ scoreNorm()

CirrusSearch\BuildDocument\Completion\QualityScore::scoreNorm ( $value,
$norm )

value / norm => [0-1]

Parameters
float$value
float$norm
Returns
float between 0 and 1

◆ scoreNormLog2()

CirrusSearch\BuildDocument\Completion\QualityScore::scoreNormLog2 ( $value,
$norm )

log2( ( value / norm ) + 1 ) => [0-1]

Parameters
float$value
float$norm
Returns
float between 0 and 1

◆ setMaxDocs()

CirrusSearch\BuildDocument\Completion\QualityScore::setMaxDocs ( $maxDocs)

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