mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 10:27:57 +00:00
reduce penalty for special searches by name
Additional penalty for special terms with operator None should only go to near searches. To reduce the number of produced searches, restrict the none operator to appear only in conjunction with the name.
This commit is contained in:
@@ -44,7 +44,10 @@ class SpecialTerm
|
||||
*/
|
||||
public function isExtendable($oSearch, $oPosition)
|
||||
{
|
||||
return !$oSearch->hasOperator() && $oPosition->isPhrase('');
|
||||
return !$oSearch->hasOperator()
|
||||
&& $oPosition->isPhrase('')
|
||||
&& ($this->iOperator != \Nominatim\Operator::NONE
|
||||
|| (!$oSearch->hasAddress() && !$oSearch->hasHousenumber() && !$oSearch->hasCountry()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,8 +69,8 @@ class SpecialTerm
|
||||
$iOp = \Nominatim\Operator::NAME;
|
||||
} else {
|
||||
$iOp = \Nominatim\Operator::NEAR;
|
||||
$iSearchCost += 2;
|
||||
}
|
||||
$iSearchCost += 2;
|
||||
} elseif (!$oPosition->isFirstToken() && !$oPosition->isLastToken()) {
|
||||
$iSearchCost += 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user