]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 18 Dec 2023 15:00:08 +0000 (16:00 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 18 Dec 2023 15:00:08 +0000 (16:00 +0100)
1  2 
nominatim/api/search/icu_tokenizer.py

index 06a06f34984e32c033837bf68c362cf34ea272e6,eabd329d57e08cac6d8b6cbc8c0a8c3c0fcf8fdd..ff1c3feed40069328d4fdc01aec77745356a70bf
@@@ -22,6 -22,7 +22,7 @@@ from nominatim.api.connection import Se
  from nominatim.api.logging import log
  from nominatim.api.search import query as qmod
  from nominatim.api.search.query_analyzer_factory import AbstractQueryAnalyzer
+ from nominatim.db.sqlalchemy_types import Json
  
  
  DB_TO_TOKEN_TYPE = {
@@@ -159,7 -160,7 +160,7 @@@ class ICUQueryAnalyzer(AbstractQueryAna
                       sa.Column('word_token', sa.Text, nullable=False),
                       sa.Column('type', sa.Text, nullable=False),
                       sa.Column('word', sa.Text),
-                      sa.Column('info', self.conn.t.types.Json))
+                      sa.Column('info', Json))
  
  
      async def analyze_query(self, phrases: List[qmod.Phrase]) -> qmod.QueryStruct:
              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]: