X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/6a0361d0c6971026e10ee695b164fc2ae22b1f3a..d9e0ef0ebfbc2860e7c0b7e7510a4014300074be:/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'] ); }