From: Sarah Hoffmann Date: Tue, 31 May 2022 15:13:56 +0000 (+0200) Subject: Merge pull request #2731 from lonvia/cleanup-special-phrases X-Git-Tag: v4.1.0~34 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/12a3d51bcc7b1a2aa5eb17c2b2dd36b71ae5610c?hp=b5ac5462752bae0209f9fb255fe98b82e6016873 Merge pull request #2731 from lonvia/cleanup-special-phrases Minor code reorganisation around special phrase parsing --- diff --git a/docs/admin/Setup-Nominatim-UI.md b/docs/admin/Setup-Nominatim-UI.md index 374a84e1..7f012660 100644 --- a/docs/admin/Setup-Nominatim-UI.md +++ b/docs/admin/Setup-Nominatim-UI.md @@ -163,22 +163,14 @@ directory like this: # If format-html is explicity requested, forward to the UI. RewriteCond %{QUERY_STRING} "format=html" - RewriteRule ^([^/]+).php ui/$1.html [R,END] - # Same but .php suffix is missing. - RewriteCond %{QUERY_STRING} "format=html" - RewriteRule ^([^/]+) ui/$1.html [R,END] + RewriteRule ^([^/]+)(.php)? ui/$1.html [R,END] # If no format parameter is there then forward anything # but /reverse and /lookup to the UI. RewriteCond %{QUERY_STRING} "!format=" RewriteCond %{REQUEST_URI} "!/lookup" RewriteCond %{REQUEST_URI} "!/reverse" - RewriteRule ^([^/]+).php ui/$1.html [R,END] - # Same but .php suffix is missing. - RewriteCond %{QUERY_STRING} "!format=" - RewriteCond %{REQUEST_URI} "!/lookup" - RewriteCond %{REQUEST_URI} "!/reverse" - RewriteRule ^([^/]+) ui/$1.html [R,END] + RewriteRule ^([^/]+)(.php)? ui/$1.html [R,END] ``` diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 65df58ef..3f3beab1 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -264,6 +264,8 @@ class SearchDescription { if (empty($this->aName)) { $this->bNameNeedsAddress = $bNeedsAddress; + } elseif ($bSearchable && count($this->aName) >= 2) { + $this->bNameNeedsAddress = false; } else { $this->bNameNeedsAddress &= $bNeedsAddress; } diff --git a/nominatim/tokenizer/icu_tokenizer.py b/nominatim/tokenizer/icu_tokenizer.py index bf5544ed..4678af66 100644 --- a/nominatim/tokenizer/icu_tokenizer.py +++ b/nominatim/tokenizer/icu_tokenizer.py @@ -482,7 +482,7 @@ class LegacyICUNameAnalyzer(AbstractAnalyzer): if not item.suffix: token_info.add_place(self._compute_partial_tokens(item.name)) elif not item.kind.startswith('_') and not item.suffix and \ - item.kind not in ('country', 'full'): + item.kind not in ('country', 'full', 'inclusion'): token_info.add_address_term(item.kind, self._compute_partial_tokens(item.name)) diff --git a/nominatim/tokenizer/legacy_tokenizer.py b/nominatim/tokenizer/legacy_tokenizer.py index 7b78b22a..a292b180 100644 --- a/nominatim/tokenizer/legacy_tokenizer.py +++ b/nominatim/tokenizer/legacy_tokenizer.py @@ -475,7 +475,8 @@ class LegacyNameAnalyzer(AbstractAnalyzer): token_info.add_street(self.conn, value) elif key == 'place': token_info.add_place(self.conn, value) - elif not key.startswith('_') and key not in ('country', 'full'): + elif not key.startswith('_') \ + and key not in ('country', 'full', 'inclusion'): addr_terms.append((key, value)) if hnrs: