]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/TokenList.php
Merge pull request #1333 from Arun179/patch-1
[nominatim.git] / lib / TokenList.php
index a91c735ed6a2e97beb33677b5680074c08b2cdae..84dc98d0584fee10558f3271582bcfe4462fd328 100644 (file)
@@ -71,7 +71,7 @@ class TokenList
     /**
      * Add token information from the word table in the database.
      *
-     * @param object   $oDB           Database connection.
+     * @param object   $oDB           Nominatim::DB instance.
      * @param string[] $aTokens       List of tokens to look up in the database.
      * @param string[] $aCountryCodes List of country restrictions.
      * @param string   $sNormQuery    Normalized query string.
@@ -85,11 +85,11 @@ class TokenList
         $sSQL = 'SELECT word_id, word_token, word, class, type, country_code,';
         $sSQL .= ' operator, coalesce(search_name_count, 0) as count';
         $sSQL .= ' FROM word WHERE word_token in (';
-        $sSQL .= join(',', array_map('getDBQuoted', $aTokens)).')';
+        $sSQL .= join(',', $oDB->getDBQuotedList($aTokens)).')';
 
         Debug::printSQL($sSQL);
 
-        $aDBWords = chksql($oDB->getAll($sSQL), 'Could not get word tokens.');
+        $aDBWords = $oDB->getAll($sSQL, null, 'Could not get word tokens.');
 
         foreach ($aDBWords as $aWord) {
             $oToken = null;
@@ -125,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']) {
@@ -138,7 +138,7 @@ class TokenList
             } else {
                 $oToken = new Token\Word(
                     $iId,
-                    $aWord['word'][0] != ' ',
+                    $aWord['word_token'][0] != ' ',
                     (int) $aWord['count']
                 );
             }