forked from hans/Nominatim
The token string is only required by the PartialToken type, so it can simply save the token string internally. No need to pass it to every type. Also moves the check for multi-word partials to the token loader code in the tokenizer. Multi-word partials can only happen with the legacy tokenizer and when the database was loaded with an older version of Nominatim. No need to keep the check for everybody.
35 lines
763 B
PHP
35 lines
763 B
PHP
<?php
|
|
|
|
namespace Nominatim\Token;
|
|
|
|
/**
|
|
* A standard word token.
|
|
*/
|
|
class Partial
|
|
{
|
|
/// Database word id, if applicable.
|
|
public $iId;
|
|
/// Number of appearances in the database.
|
|
public $iSearchNameCount;
|
|
/// Normalised version of the partial word.
|
|
public $sToken;
|
|
|
|
public function __construct($iId, $sToken, $iSearchNameCount)
|
|
{
|
|
$this->iId = $iId;
|
|
$this->sToken = $sToken;
|
|
$this->iSearchNameCount = $iSearchNameCount;
|
|
}
|
|
|
|
public function debugInfo()
|
|
{
|
|
return array(
|
|
'ID' => $this->iId,
|
|
'Type' => 'partial',
|
|
'Info' => array(
|
|
'count' => $this->iSearchNameCount
|
|
)
|
|
);
|
|
}
|
|
}
|