]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 1 Apr 2024 13:05:36 +0000 (15:05 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 1 Apr 2024 13:05:36 +0000 (15:05 +0200)
1  2 
nominatim/api/search/icu_tokenizer.py

index 23cfa5a166c003a1b5638f0334d10636a335d935,eb90c122eb43277a18b2d71bf48eb9ab99a375ac..f6590f5b36f87f0ac81f80dd5c1ef7a12fb8a726
@@@ -122,10 -122,10 +122,10 @@@ class ICUToken(qmod.Token)
          else:
              lookup_word = row.word_token
  
-         return ICUToken(penalty=penalty, token=row.word_id, count=count,
+         return ICUToken(penalty=penalty, token=row.word_id, count=max(1, count),
                          lookup_word=lookup_word, is_indexed=True,
                          word_token=row.word_token, info=row.info,
-                         addr_count=addr_count)
+                         addr_count=max(1, addr_count))
  
  
  
@@@ -208,12 -208,7 +208,12 @@@ class ICUQueryAnalyzer(AbstractQueryAna
              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]: