Explanation
extends Explanation
in package
Solr Explanation
Tags
Table of Contents
- $baseScore : float
- Relevance score of the title with the recordId without modifiers (boost / coord).
- $boost : float
- Value of boost.
- $config : Config
- Configuration
- $coord : float
- Value of coord. If only 2 out of 4 search query parts match, then coord would be 1/2.
- $explanation : array<string|int, mixed>
- The main result of the explain class, an array with every match and its values.
- $explanationForRest : array<string|int, mixed>
- Contains the fields that were removed from the main explanation.
- $lookfor : string
- Search string used for query.
- $maxScore : float
- Value of the relevance score of the best match.
- $params : Params
- Search parameters object
- $rawExplanation : string
- Raw explanation.
- $recordId : string
- RecordId of title the explanation is built for.
- $rest : array<string|int, mixed>|null
- Describes the rest. It has restValue and the percentage from total value.
- $searchIni : string
- Configuration file to read search settings from
- $searchService : Service
- Search Service
- $totalScore : float
- Relevance score of the title with the recordId.
- __construct() : mixed
- Constructor
- getBaseScore() : float
- Get relevance score of this title without modifier (boost/coord).
- getBoost() : float
- Get value of the boost used in Solr query.
- getCoord() : float
- Get value of coord.
- getDecimalPlaces() : int
- Get number of decimal places for to be shown in the explanation.
- getExplanation() : array<string|int, mixed>
- Get the explanation, parsed from Solr response.
- getExplanationForRest() : array<string|int, mixed>
- Get the explanation for the rest.
- getLookfor() : string
- Get the search string used for query.
- getMaxFields() : int
- Get the maximal number of fields to be included.
- getMaxScore() : float
- Get relevance value of best scoring title.
- getMinPercentage() : float
- Get the minimal percentage for fields to be included.
- getParams() : Params
- Get the search parameters object.
- getRawExplanation() : string
- Get the raw explanation.
- getRecordId() : string
- Get the record id of title the explanation is built for.
- getRest() : array<string|int, mixed>
- Get rest. It has restValue and the percentage from total value.
- getTotalScore() : float
- Get relevance score of this title.
- performRequest() : void
- Performing request and creating explanation.
- build() : void
- Builds explanation and sets up debug message to see raw Solr response.
- buildRecursive() : string
- Goes through each line of explainOther response adding a matched field to $explanation.
- cleanLines() : array<string|int, mixed>
- Norms the response by replacing expressions to support all versions of Solr. Removes empty lines.
- getChildLines() : array<string|int, mixed>
- Gets all lines with one level higher than the parent line.
- getLevel() : int
- Returns indent of a line.
- parseExplainElement() : array<string|int, mixed>
- Unites all infos of a match to an explainElement.
- parseLine() : array<string|int, mixed>
- Extracts value and description of a line.
Properties
$baseScore
Relevance score of the title with the recordId without modifiers (boost / coord).
protected
float
$baseScore
$boost
Value of boost.
protected
float
$boost
$config
Configuration
protected
Config
$config
$coord
Value of coord. If only 2 out of 4 search query parts match, then coord would be 1/2.
protected
float
$coord
It adjusts the score so that the 2 other search query parts also influence the score.
$explanation
The main result of the explain class, an array with every match and its values.
protected
array<string|int, mixed>
$explanation
= []
$explanationForRest
Contains the fields that were removed from the main explanation.
protected
array<string|int, mixed>
$explanationForRest
= []
$lookfor
Search string used for query.
protected
string
$lookfor
$maxScore
Value of the relevance score of the best match.
protected
float
$maxScore
$params
Search parameters object
protected
Params
$params
$rawExplanation
Raw explanation.
protected
string
$rawExplanation
= null
$recordId
RecordId of title the explanation is built for.
protected
string
$recordId
$rest
Describes the rest. It has restValue and the percentage from total value.
protected
array<string|int, mixed>|null
$rest
= null
$searchIni
Configuration file to read search settings from
protected
string
$searchIni
= 'searches'
$searchService
Search Service
protected
Service
$searchService
$totalScore
Relevance score of the title with the recordId.
protected
float
$totalScore
Methods
__construct()
Constructor
public
__construct(Params $params, Service $searchService, PluginManager $configLoader) : mixed
Parameters
- $params : Params
-
Search Parameter
- $searchService : Service
-
Search Service
- $configLoader : PluginManager
-
Config Loader
Return values
mixed —getBaseScore()
Get relevance score of this title without modifier (boost/coord).
public
getBaseScore() : float
Return values
float —getBoost()
Get value of the boost used in Solr query.
public
getBoost() : float
Return values
float —getCoord()
Get value of coord.
public
getCoord() : float
Return values
float —getDecimalPlaces()
Get number of decimal places for to be shown in the explanation.
public
getDecimalPlaces() : int
Return values
int —getExplanation()
Get the explanation, parsed from Solr response.
public
getExplanation() : array<string|int, mixed>
Return values
array<string|int, mixed> —getExplanationForRest()
Get the explanation for the rest.
public
getExplanationForRest() : array<string|int, mixed>
Return values
array<string|int, mixed> —getLookfor()
Get the search string used for query.
public
getLookfor() : string
Return values
string —getMaxFields()
Get the maximal number of fields to be included.
public
getMaxFields() : int
Return values
int —getMaxScore()
Get relevance value of best scoring title.
public
getMaxScore() : float
Return values
float —getMinPercentage()
Get the minimal percentage for fields to be included.
public
getMinPercentage() : float
Return values
float —getParams()
Get the search parameters object.
public
getParams() : Params
Return values
Params —getRawExplanation()
Get the raw explanation.
public
getRawExplanation() : string
Return values
string —getRecordId()
Get the record id of title the explanation is built for.
public
getRecordId() : string
Return values
string —getRest()
Get rest. It has restValue and the percentage from total value.
public
getRest() : array<string|int, mixed>
Return values
array<string|int, mixed> —getTotalScore()
Get relevance score of this title.
public
getTotalScore() : float
Return values
float —performRequest()
Performing request and creating explanation.
public
performRequest(string $recordId) : void
Parameters
- $recordId : string
-
Record Id
Tags
Return values
void —build()
Builds explanation and sets up debug message to see raw Solr response.
protected
build(array<string|int, mixed> $response, string $recordId) : void
Parameters
- $response : array<string|int, mixed>
-
Solr response
- $recordId : string
-
recordId of title for Solr explainOther
Tags
Return values
void —buildRecursive()
Goes through each line of explainOther response adding a matched field to $explanation.
protected
buildRecursive(array<string|int, mixed> $lines, float $modifier) : string
Parameters
- $lines : array<string|int, mixed>
-
Solr lines
- $modifier : float
-
1 (* tieValue)
Tags
Return values
string —Solr lines without the last inspected line
cleanLines()
Norms the response by replacing expressions to support all versions of Solr. Removes empty lines.
protected
cleanLines(string $lines) : array<string|int, mixed>
Parameters
- $lines : string
-
raw lines
Return values
array<string|int, mixed> —normed lines
getChildLines()
Gets all lines with one level higher than the parent line.
protected
getChildLines(array<string|int, mixed> $lines, int $level) : array<string|int, mixed>
Parameters
- $lines : array<string|int, mixed>
-
Lines
- $level : int
-
Level
Return values
array<string|int, mixed> —getLevel()
Returns indent of a line.
protected
getLevel(string $line) : int
Parameters
- $line : string
-
Line
Return values
int —parseExplainElement()
Unites all infos of a match to an explainElement.
protected
parseExplainElement(float $value, string $description, float $percentage, float $fieldModifier) : array<string|int, mixed>
Parameters
- $value : float
-
Value
- $description : string
-
Description
- $percentage : float
-
Percentage
- $fieldModifier : float
-
Field Modifier
Return values
array<string|int, mixed> —parseLine()
Extracts value and description of a line.
protected
parseLine(string $line) : array<string|int, mixed>
Parameters
- $line : string
-
Line