mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-25 22:12:45 +03:00
0f87da017f
Multi-word partial terms had an undue advantage over separate partial terms because they only need to pay the penalty once. This changes the behaviour by setting the penalty according to the number of words in the token. This should get rid of search interpretations with low chance of matching. This also fixes handling of exact term matching. We now match against all exact terms of the query, not just a couple of them collected while building the interpretations. Also adds a penalty to very short postcodes.
39 lines
956 B
PHP
39 lines
956 B
PHP
<?php
|
|
|
|
namespace Nominatim\Token;
|
|
|
|
/**
|
|
* A standard word token.
|
|
*/
|
|
class Word
|
|
{
|
|
/// Database word id, if applicable.
|
|
public $iId;
|
|
/// If true, the word may represent only part of a place name.
|
|
public $bPartial;
|
|
/// Number of appearances in the database.
|
|
public $iSearchNameCount;
|
|
/// Number of terms in the word.
|
|
public $iTermCount;
|
|
|
|
public function __construct($iId, $bPartial, $iSearchNameCount, $iTermCount)
|
|
{
|
|
$this->iId = $iId;
|
|
$this->bPartial = $bPartial;
|
|
$this->iSearchNameCount = $iSearchNameCount;
|
|
$this->iTermCount = $iTermCount;
|
|
}
|
|
|
|
public function debugInfo()
|
|
{
|
|
return array(
|
|
'ID' => $this->iId,
|
|
'Type' => 'word',
|
|
'Info' => array(
|
|
'partial' => $this->bPartial,
|
|
'count' => $this->iSearchNameCount
|
|
)
|
|
);
|
|
}
|
|
}
|