]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #2731 from lonvia/cleanup-special-phrases
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 31 May 2022 15:13:56 +0000 (17:13 +0200)
committerGitHub <noreply@github.com>
Tue, 31 May 2022 15:13:56 +0000 (17:13 +0200)
Minor code reorganisation around special phrase parsing

docs/admin/Setup-Nominatim-UI.md
lib-php/SearchDescription.php
nominatim/tokenizer/icu_tokenizer.py
nominatim/tokenizer/legacy_tokenizer.py

index 374a84e197ccf9032ab8e883e7f303ecdd138c25..7f0126603a80380cd826908b5c6a4cb6f78ac903 100644 (file)
@@ -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]
 </Directory>
 ```
 
index 65df58ef0850b120bbc4e5a1b7b8af19dfd9ef34..3f3beab1964dd2e2578c117bac663ce9baa5535c 100644 (file)
@@ -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;
         }
index bf5544ed0c06064946bef2b48fa9c217a5312c29..4678af66eb08d019b30e38bb8280da108083bd13 100644 (file)
@@ -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))
 
 
index 7b78b22a87066370bba513072b0ace30c7b7078a..a292b180b8d5b153496c4641fdd5fc2de139f899 100644 (file)
@@ -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: