+ $this->oNormalizer = \Transliterator::createFromRules(CONST_Term_Normalization_Rules);
+ }
+
+ private function normTerm($sTerm)
+ {
+ if ($this->oNormalizer === null) {
+ return null;
+ }
+
+ return $this->oNormalizer->transliterate($sTerm);
}
} elseif ($sPhraseType == 'postalcode' || ($aSearchTerm['class'] == 'place' && $aSearchTerm['type'] == 'postcode')) {
// We need to try the case where the postal code is the primary element (i.e. no way to tell if it is (postalcode, city) OR (city, postalcode) so try both
}
} elseif ($sPhraseType == 'postalcode' || ($aSearchTerm['class'] == 'place' && $aSearchTerm['type'] == 'postcode')) {
// We need to try the case where the postal code is the primary element (i.e. no way to tell if it is (postalcode, city) OR (city, postalcode) so try both
// If we have structured search or this is the first term,
// make the postcode the primary search element.
if ($aSearchTerm['operator'] == '' && ($sPhraseType == 'postalcode' || sizeof($aSearch['aName']) == 0)) {
$aNewSearch = $aSearch;
$aNewSearch['sOperator'] = 'postcode';
$aNewSearch['aAddress'] = array_merge($aNewSearch['aAddress'], $aNewSearch['aName']);
// If we have structured search or this is the first term,
// make the postcode the primary search element.
if ($aSearchTerm['operator'] == '' && ($sPhraseType == 'postalcode' || sizeof($aSearch['aName']) == 0)) {
$aNewSearch = $aSearch;
$aNewSearch['sOperator'] = 'postcode';
$aNewSearch['aAddress'] = array_merge($aNewSearch['aAddress'], $aNewSearch['aName']);
if ($aSearch['iSearchRank'] < $this->iMaxRank) $aNewWordsetSearches[] = $aNewSearch;
}
// If we have a structured search or this is not the first term,
// add the postcode as an addendum.
if ($sPhraseType == 'postalcode' || sizeof($aSearch['aName'])) {
if ($aSearch['iSearchRank'] < $this->iMaxRank) $aNewWordsetSearches[] = $aNewSearch;
}
// If we have a structured search or this is not the first term,
// add the postcode as an addendum.
if ($sPhraseType == 'postalcode' || sizeof($aSearch['aName'])) {
- $oNormalizer = \Transliterator::createFromRules(CONST_Term_Normalization_Rules);
- if ($oNormalizer !== null) {
- $sNormQuery = $oNormalizer->transliterate($this->sQuery);
- } else {
- $sNormQuery = null;
- }
-
+ $sNormQuery = $this->normTerm($this->sQuery);
$sLanguagePrefArraySQL = "ARRAY[".join(',', array_map("getDBQuoted", $this->aLangPrefOrder))."]";
$sCountryCodesSQL = false;
if ($this->aCountryCodes) {
$sLanguagePrefArraySQL = "ARRAY[".join(',', array_map("getDBQuoted", $this->aLangPrefOrder))."]";
$sCountryCodesSQL = false;
if ($this->aCountryCodes) {