]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 28 Nov 2023 19:03:04 +0000 (20:03 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 28 Nov 2023 19:03:04 +0000 (20:03 +0100)
1  2 
nominatim/api/search/icu_tokenizer.py

index 14203e0081eb1df470025f6285b7b46896223123,fceec2df522feb5105936204b099e9a8a7a2ad96..06a06f34984e32c033837bf68c362cf34ea272e6
@@@ -184,13 -184,13 +184,13 @@@ class ICUQueryAnalyzer(AbstractQueryAna
                  if row.type == 'S':
                      if row.info['op'] in ('in', 'near'):
                          if trange.start == 0:
-                             query.add_token(trange, qmod.TokenType.CATEGORY, token)
+                             query.add_token(trange, qmod.TokenType.NEAR_ITEM, token)
                      else:
                          query.add_token(trange, qmod.TokenType.QUALIFIER, token)
                          if trange.start == 0 or trange.end == query.num_token_slots():
                              token = copy(token)
                              token.penalty += 0.1 * (query.num_token_slots())
-                             query.add_token(trange, qmod.TokenType.CATEGORY, token)
+                             query.add_token(trange, qmod.TokenType.NEAR_ITEM, 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]: