]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/tokenizer/icu_tokenizer.php
decode_json() always create arrays instead of objects
[nominatim.git] / lib-php / tokenizer / icu_tokenizer.php
index ccce99ca1330d7a42a6976d7fb7c9eaf3d8a84d7..e45d07654843b9c1c6127f40f3d064441ea4bc79 100644 (file)
@@ -190,13 +190,17 @@ class Tokenizer
                     if ($aWord['word'] !== null
                         && pg_escape_string($aWord['word']) == $aWord['word']
                     ) {
                     if ($aWord['word'] !== null
                         && pg_escape_string($aWord['word']) == $aWord['word']
                     ) {
-                        $sNormPostcode = $this->normalizeString($aWord['word']);
-                        if (strpos($sNormQuery, $sNormPostcode) !== false) {
-                            $oValidTokens->addToken(
-                                $sTok,
-                                new Token\Postcode($iId, $aWord['word'], null)
-                            );
+                        $iSplitPos = strpos($aWord['word'], '@');
+                        if ($iSplitPos === false) {
+                            $sPostcode = $aWord['word'];
+                        } else {
+                            $sPostcode = substr($aWord['word'], 0, $iSplitPos);
                         }
                         }
+
+                        $oValidTokens->addToken(
+                            $sTok,
+                            new Token\Postcode($iId, $sPostcode, null)
+                        );
                     }
                     break;
                 case 'S':  // tokens for classification terms (special phrases)
                     }
                     break;
                 case 'S':  // tokens for classification terms (special phrases)