forked from hans/Nominatim
merge marking rare name with adding name token
Only name tokens can be rare, so this should be the same function.
This commit is contained in:
@@ -223,11 +223,14 @@ class SearchDescription
|
|||||||
* Add the given full-word token to the list of terms to search for in the
|
* Add the given full-word token to the list of terms to search for in the
|
||||||
* name.
|
* name.
|
||||||
*
|
*
|
||||||
* @param interger iId ID of term to add.
|
* @param interger iId ID of term to add.
|
||||||
|
* @param bool bRareName True if the term is infrequent enough to not
|
||||||
|
* require other constraints for efficient search.
|
||||||
*/
|
*/
|
||||||
public function addNameToken($iId)
|
public function addNameToken($iId, $bRareName)
|
||||||
{
|
{
|
||||||
$this->aName[$iId] = $iId;
|
$this->aName[$iId] = $iId;
|
||||||
|
$this->bRareName = $bRareName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -250,11 +253,6 @@ class SearchDescription
|
|||||||
$this->iNamePhrase = $iPhraseNumber;
|
$this->iNamePhrase = $iPhraseNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function markRareName()
|
|
||||||
{
|
|
||||||
$this->bRareName = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set country restriction for the search.
|
* Set country restriction for the search.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -70,13 +70,12 @@ class Word
|
|||||||
}
|
}
|
||||||
} elseif (!$oSearch->hasName(true)) {
|
} elseif (!$oSearch->hasName(true)) {
|
||||||
$oNewSearch = $oSearch->clone(1);
|
$oNewSearch = $oSearch->clone(1);
|
||||||
$oNewSearch->addNameToken($this->iId);
|
$oNewSearch->addNameToken(
|
||||||
if (CONST_Search_NameOnlySearchFrequencyThreshold
|
$this->iId,
|
||||||
|
CONST_Search_NameOnlySearchFrequencyThreshold
|
||||||
&& $this->iSearchNameCount
|
&& $this->iSearchNameCount
|
||||||
< CONST_Search_NameOnlySearchFrequencyThreshold
|
< CONST_Search_NameOnlySearchFrequencyThreshold
|
||||||
) {
|
);
|
||||||
$oNewSearch->markRareName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($oNewSearch);
|
return array($oNewSearch);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user