From 86ea07709218a7ec8ae18e53268f8c67b42c9f17 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 18 Jul 2021 16:52:37 +0200 Subject: [PATCH] merge marking rare name with adding name token Only name tokens can be rare, so this should be the same function. --- lib-php/SearchDescription.php | 12 +++++------- lib-php/TokenWord.php | 9 ++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 01d06725..4d944bfb 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -223,11 +223,14 @@ class SearchDescription * Add the given full-word token to the list of terms to search for in the * 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->bRareName = $bRareName; } /** @@ -250,11 +253,6 @@ class SearchDescription $this->iNamePhrase = $iPhraseNumber; } - public function markRareName() - { - $this->bRareName = true; - } - /** * Set country restriction for the search. * diff --git a/lib-php/TokenWord.php b/lib-php/TokenWord.php index c9a43915..59456e35 100644 --- a/lib-php/TokenWord.php +++ b/lib-php/TokenWord.php @@ -70,13 +70,12 @@ class Word } } elseif (!$oSearch->hasName(true)) { $oNewSearch = $oSearch->clone(1); - $oNewSearch->addNameToken($this->iId); - if (CONST_Search_NameOnlySearchFrequencyThreshold + $oNewSearch->addNameToken( + $this->iId, + CONST_Search_NameOnlySearchFrequencyThreshold && $this->iSearchNameCount < CONST_Search_NameOnlySearchFrequencyThreshold - ) { - $oNewSearch->markRareName(); - } + ); return array($oNewSearch); } -- 2.39.5