mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-27 00:49:55 +03:00
do not mix partial names with other words
As soon as a housenumber, postcode, etc. appear, the name term must obviously be closed and no further partial terms can be appended.
This commit is contained in:
parent
3fbe4511f9
commit
6dd2b9c2ec
@ -179,6 +179,7 @@ class SearchDescription
|
|||||||
// - increase score for finding it anywhere else (optimisation)
|
// - increase score for finding it anywhere else (optimisation)
|
||||||
if (!$bLastToken) {
|
if (!$bLastToken) {
|
||||||
$oSearch->iSearchRank += 5;
|
$oSearch->iSearchRank += 5;
|
||||||
|
$oSearch->iNamePhrase = -1;
|
||||||
}
|
}
|
||||||
$aNewSearches[] = $oSearch;
|
$aNewSearches[] = $oSearch;
|
||||||
}
|
}
|
||||||
@ -205,6 +206,7 @@ class SearchDescription
|
|||||||
) {
|
) {
|
||||||
$oSearch = clone $this;
|
$oSearch = clone $this;
|
||||||
$oSearch->iSearchRank++;
|
$oSearch->iSearchRank++;
|
||||||
|
$oSearch->iNamePhrase = -1;
|
||||||
if (strlen($oSearchTerm->sPostcode) < 4) {
|
if (strlen($oSearchTerm->sPostcode) < 4) {
|
||||||
$oSearch->iSearchRank += 4 - strlen($oSearchTerm->sPostcode);
|
$oSearch->iSearchRank += 4 - strlen($oSearchTerm->sPostcode);
|
||||||
}
|
}
|
||||||
@ -218,6 +220,7 @@ class SearchDescription
|
|||||||
if (!$this->sHouseNumber && $this->iOperator != Operator::POSTCODE) {
|
if (!$this->sHouseNumber && $this->iOperator != Operator::POSTCODE) {
|
||||||
$oSearch = clone $this;
|
$oSearch = clone $this;
|
||||||
$oSearch->iSearchRank++;
|
$oSearch->iSearchRank++;
|
||||||
|
$oSearch->iNamePhrase = -1;
|
||||||
$oSearch->sHouseNumber = $oSearchTerm->sToken;
|
$oSearch->sHouseNumber = $oSearchTerm->sToken;
|
||||||
if ($this->iOperator != Operator::NONE) {
|
if ($this->iOperator != Operator::NONE) {
|
||||||
$oSearch->iSearchRank++;
|
$oSearch->iSearchRank++;
|
||||||
@ -259,6 +262,7 @@ class SearchDescription
|
|||||||
if ($this->iOperator == Operator::NONE) {
|
if ($this->iOperator == Operator::NONE) {
|
||||||
$oSearch = clone $this;
|
$oSearch = clone $this;
|
||||||
$oSearch->iSearchRank += 2;
|
$oSearch->iSearchRank += 2;
|
||||||
|
$oSearch->iNamePhrase = -1;
|
||||||
|
|
||||||
$iOp = $oSearchTerm->iOperator;
|
$iOp = $oSearchTerm->iOperator;
|
||||||
if ($iOp == Operator::NONE) {
|
if ($iOp == Operator::NONE) {
|
||||||
@ -293,6 +297,7 @@ class SearchDescription
|
|||||||
if (!empty($this->aName) || !($bFirstPhrase || $sPhraseType == '')) {
|
if (!empty($this->aName) || !($bFirstPhrase || $sPhraseType == '')) {
|
||||||
if (($sPhraseType == '' || !$bFirstPhrase) && !$bHasPartial) {
|
if (($sPhraseType == '' || !$bFirstPhrase) && !$bHasPartial) {
|
||||||
$oSearch = clone $this;
|
$oSearch = clone $this;
|
||||||
|
$oSearch->iNamePhrase = -1;
|
||||||
$oSearch->iSearchRank += 3 * $oSearchTerm->iTermCount;
|
$oSearch->iSearchRank += 3 * $oSearchTerm->iTermCount;
|
||||||
$oSearch->aAddress[$iWordID] = $iWordID;
|
$oSearch->aAddress[$iWordID] = $iWordID;
|
||||||
$aNewSearches[] = $oSearch;
|
$aNewSearches[] = $oSearch;
|
||||||
|
Loading…
Reference in New Issue
Block a user