mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
add one-rank penalty for using partial search
Ensures that full matches are preferred over partial ones even when the full word consists of only one term.
This commit is contained in:
@@ -347,10 +347,13 @@ class SearchDescription
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!$this->sPostcode && !$this->aAddress && !$this->aAddressNonSearch)
|
if ((!$this->sPostcode && !$this->aAddress && !$this->aAddressNonSearch)
|
||||||
&& (empty($this->aName) || $this->iNamePhrase == $iPhrase)
|
&& ((empty($this->aName) && empty($this->aNameNonSearch)) || $this->iNamePhrase == $iPhrase)
|
||||||
) {
|
) {
|
||||||
$oSearch = clone $this;
|
$oSearch = clone $this;
|
||||||
$oSearch->iSearchRank++;
|
$oSearch->iSearchRank++;
|
||||||
|
if (empty($this->aName) && empty($this->aNameNonSearch)) {
|
||||||
|
$oSearch->iSearchRank++;
|
||||||
|
}
|
||||||
if (preg_match('#^[0-9 ]+$#', $sToken)) {
|
if (preg_match('#^[0-9 ]+$#', $sToken)) {
|
||||||
$oSearch->iSearchRank++;
|
$oSearch->iSearchRank++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user