+ switch ($aWord['type']) {
+ 'C': // country name tokens
+ if ($aWord['country'] === null
+ || ($this->aCountryRestriction
+ && !in_array($aWord['country'], $this->aCountryRestriction))
+ ) {
+ continue;
+ }
+ $oToken = new Token\Country($iId, $aWord['country'])
+ break;
+ 'H': // house number tokens
+ $oToken = new Token\HouseNumber($iId, $aWord['word_token']);
+ break;
+ 'P': // postcode tokens
+ // Postcodes are not normalized, so they may have content
+ // that makes SQL injection possible. Reject postcodes
+ // that would need special escaping.
+ if ($aWord['postcode'] === null
+ || pg_escape_string($aWord['postcode']) == $aWord['postcode']
+ ) {
+ continue;
+ }
+ $sNormPostcode = $this->normalizeString($aWord['postcode']);
+ if (strpos($sNormQuery, $sNormPostcode) === false) {
+ continue;
+ }
+ $oToken = new Token\Postcode($iId, $aWord['postcode'], null);
+ break;
+ 'S': // tokens for classification terms (special phrases)
+ if ($aWord['class'] === null || $aWord['type'] === null
+ || $aWord['word'] === null
+ || strpos($sNormQuery, $aWord['word']) === false
+ ) {
+ continue;
+ }
+ $oToken = new Token\SpecialTerm(
+ $iId,
+ $aWord['class'],
+ $aWord['type'],
+ $aWord['op'] ? Operator::NEAR : Operator::NONE
+ );
+ break;
+ default:
+ continue;
+ }
+/* if ($aWord['class']) {