1 # SPDX-License-Identifier: GPL-3.0-or-later
 
   3 # This file is part of Nominatim. (https://nominatim.org)
 
   5 # Copyright (C) 2024 by the Nominatim developer community.
 
   6 # For a full list of authors see the git log.
 
   8 Common data types and protocols for preprocessing.
 
  10 from typing import List, Callable
 
  12 from ..typing import Protocol
 
  13 from ..search import query as qmod
 
  14 from .config import QueryConfig
 
  16 QueryProcessingFunc = Callable[[List[qmod.Phrase]], List[qmod.Phrase]]
 
  19 class QueryHandler(Protocol):
 
  20     """ Protocol for query modules.
 
  22     def create(self, config: QueryConfig) -> QueryProcessingFunc:
 
  24         Create a function for sanitizing a place.
 
  26             config: A dictionary with the additional configuration options
 
  27                     specified in the tokenizer configuration
 
  28             normalizer: A instance to transliterate text
 
  30             The result is a list modified by the preprocessor.