X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6a0361d0c6971026e10ee695b164fc2ae22b1f3a..c5e792def965b0f4dccd42c80e0901a5a8f4d19b:/lib/TokenList.php diff --git a/lib/TokenList.php b/lib/TokenList.php index 96b756f8..a5b3c2d2 100644 --- a/lib/TokenList.php +++ b/lib/TokenList.php @@ -32,6 +32,17 @@ class TokenList // List of list of tokens indexed by their word_token. private $aTokens = array(); + + /** + * Return total number of tokens. + * + * @return Integer + */ + public function count() + { + return count($this->aTokens); + } + /** * Check if there are tokens for the given token word. * @@ -114,7 +125,7 @@ class TokenList $iId, $aWord['class'], $aWord['type'], - $aWord['operator'] ? Operator::NONE : Operator::NEAR + $aWord['operator'] ? Operator::NEAR : Operator::NONE ); } } elseif ($aWord['country_code']) { @@ -127,7 +138,7 @@ class TokenList } else { $oToken = new Token\Word( $iId, - $aWord['word'][0] != ' ', + $aWord['word_token'][0] != ' ', (int) $aWord['count'] ); }