]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 19 Feb 2025 19:51:20 +0000 (20:51 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 19 Feb 2025 19:51:20 +0000 (20:51 +0100)
1  2 
src/nominatim_api/search/icu_tokenizer.py

index 8f2069c1a8bc57212956d1ce64d3a5914c12f920,487dd1710354c9c9801cef9ce22033c1a5169e87..44afce9f3f69baf6475b0090eb388906bdef3c26
@@@ -208,12 -208,6 +208,12 @@@ class ICUQueryAnalyzer(AbstractQueryAna
          log().section('Analyze query (using ICU tokenizer)')
          for func in self.preprocessors:
              phrases = func(phrases)
 +
 +        if len(phrases) == 1 \
 +                and phrases[0].text.count(' ') > 3 \
 +                and max(len(s) for s in phrases[0].text.split()) < 3:
 +            normalized = []
 +
          query = qmod.QueryStruct(phrases)
  
          log().var_dump('Normalized query', query.source)
              standardized form search will work with. All information removed
              at this stage is inevitably lost.
          """
-         return cast(str, self.normalizer.transliterate(text))
+         return cast(str, self.normalizer.transliterate(text)).strip('-: ')
  
      def split_query(self, query: qmod.QueryStruct) -> Tuple[QueryParts, WordDict]:
          """ Transliterate the phrases and split them into tokens.