X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/dd50f1737b1032f92b4e884a08354caad44571f9..3cdfe066336ad19772d300a85d6c1feaadc074ea:/lib/TokenList.php diff --git a/lib/TokenList.php b/lib/TokenList.php index fce5f940..a419da6a 100644 --- a/lib/TokenList.php +++ b/lib/TokenList.php @@ -2,12 +2,12 @@ namespace Nominatim; -require_once(CONST_BasePath.'/lib/TokenCountry.php'); -require_once(CONST_BasePath.'/lib/TokenHousenumber.php'); -require_once(CONST_BasePath.'/lib/TokenPostcode.php'); -require_once(CONST_BasePath.'/lib/TokenSpecialTerm.php'); -require_once(CONST_BasePath.'/lib/TokenWord.php'); -require_once(CONST_BasePath.'/lib/SpecialSearchOperator.php'); +require_once(CONST_LibDir.'/TokenCountry.php'); +require_once(CONST_LibDir.'/TokenHousenumber.php'); +require_once(CONST_LibDir.'/TokenPostcode.php'); +require_once(CONST_LibDir.'/TokenSpecialTerm.php'); +require_once(CONST_LibDir.'/TokenWord.php'); +require_once(CONST_LibDir.'/SpecialSearchOperator.php'); /** * Saves information about the tokens that appear in a search query. @@ -80,6 +80,21 @@ class TokenList return isset($this->aTokens[$sWord]) ? $this->aTokens[$sWord] : array(); } + public function getFullWordIDs() + { + $ids = array(); + + foreach ($this->aTokens as $aTokenList) { + foreach ($aTokenList as $oToken) { + if (is_a($oToken, '\Nominatim\Token\Word') && !$oToken->bPartial) { + $ids[$oToken->iId] = $oToken->iId; + } + } + } + + return $ids; + } + /** * Add token information from the word table in the database. * @@ -151,7 +166,8 @@ class TokenList $oToken = new Token\Word( $iId, $aWord['word_token'][0] != ' ', - (int) $aWord['count'] + (int) $aWord['count'], + substr_count($aWord['word_token'], ' ') ); }