]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 17 Jan 2024 09:48:11 +0000 (10:48 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 17 Jan 2024 09:48:11 +0000 (10:48 +0100)
1  2 
nominatim/api/search/icu_tokenizer.py

index 6f3e09e88d2dc503ed0471c2eaa2f3c05f903562,1c2565d1ad60c80df1f1ecb78b216439b8d98224..76a1a2e5d362688d5388044b511a9d3f0ae4a13c
@@@ -186,7 -186,10 +186,10 @@@ class ICUQueryAnalyzer(AbstractQueryAna
                          if trange.start == 0:
                              query.add_token(trange, qmod.TokenType.NEAR_ITEM, token)
                      else:
-                         query.add_token(trange, qmod.TokenType.QUALIFIER, token)
+                         if trange.start == 0 and trange.end == query.num_token_slots():
+                             query.add_token(trange, qmod.TokenType.NEAR_ITEM, token)
+                         else:
+                             query.add_token(trange, qmod.TokenType.QUALIFIER, token)
                  else:
                      query.add_token(trange, DB_TO_TOKEN_TYPE[row.type], token)
  
              standardized form search will work with. All information removed
              at this stage is inevitably lost.
          """
 -        return cast(str, self.normalizer.transliterate(text))
 +        norm = cast(str, self.normalizer.transliterate(text))
 +        numspaces = norm.count(' ')
 +        if numspaces > 4 and len(norm) <= (numspaces + 1) * 3:
 +            return ''
 +
 +        return norm
  
  
      def split_query(self, query: qmod.QueryStruct) -> Tuple[QueryParts, WordDict]: