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:
Sarah Hoffmann
2021-03-11 17:34:23 +01:00
parent f498e40208
commit 478dfb0639

View File

@@ -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++;
}