forked from hans/Nominatim
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)
|
||||
&& (empty($this->aName) || $this->iNamePhrase == $iPhrase)
|
||||
&& ((empty($this->aName) && empty($this->aNameNonSearch)) || $this->iNamePhrase == $iPhrase)
|
||||
) {
|
||||
$oSearch = clone $this;
|
||||
$oSearch->iSearchRank++;
|
||||
if (empty($this->aName) && empty($this->aNameNonSearch)) {
|
||||
$oSearch->iSearchRank++;
|
||||
}
|
||||
if (preg_match('#^[0-9 ]+$#', $sToken)) {
|
||||
$oSearch->iSearchRank++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user