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