]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/TokenList.php
allow nginx to serve files without php extensions
[nominatim.git] / lib / TokenList.php
index 96b756f8b11c4b23c901ab45182f81e1f548fe25..a5b3c2d28710214ec21b7b0a2c2b0c248ca84746 100644 (file)
@@ -32,6 +32,17 @@ class TokenList
     // List of list of tokens indexed by their word_token.
     private $aTokens = array();
 
     // 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.
      *
     /**
      * Check if there are tokens for the given token word.
      *
@@ -114,7 +125,7 @@ class TokenList
                         $iId,
                         $aWord['class'],
                         $aWord['type'],
                         $iId,
                         $aWord['class'],
                         $aWord['type'],
-                        $aWord['operator'] ? Operator::NONE : Operator::NEAR
+                        $aWord['operator'] ? Operator::NEAR : Operator::NONE
                     );
                 }
             } elseif ($aWord['country_code']) {
                     );
                 }
             } elseif ($aWord['country_code']) {
@@ -127,7 +138,7 @@ class TokenList
             } else {
                 $oToken = new Token\Word(
                     $iId,
             } else {
                 $oToken = new Token\Word(
                     $iId,
-                    $aWord['word'][0] != ' ',
+                    $aWord['word_token'][0] != ' ',
                     (int) $aWord['count']
                 );
             }
                     (int) $aWord['count']
                 );
             }