X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4da4cbfe27a576ae011430b2de205c74435e241b..57598a048e9124b905572ed8dc4fa9465b5d38a6:/src/nominatim_api/search/db_search_fields.py?ds=sidebyside diff --git a/src/nominatim_api/search/db_search_fields.py b/src/nominatim_api/search/db_search_fields.py index 95b2b4a7..6bd33094 100644 --- a/src/nominatim_api/search/db_search_fields.py +++ b/src/nominatim_api/search/db_search_fields.py @@ -28,11 +28,9 @@ class WeightedStrings: def __bool__(self) -> bool: return bool(self.values) - def __iter__(self) -> Iterator[Tuple[str, float]]: return iter(zip(self.values, self.penalties)) - def get_penalty(self, value: str, default: float = 1000.0) -> float: """ Get the penalty for the given value. Returns the given default if the value does not exist. @@ -54,11 +52,9 @@ class WeightedCategories: def __bool__(self) -> bool: return bool(self.values) - def __iter__(self) -> Iterator[Tuple[Tuple[str, str], float]]: return iter(zip(self.values, self.penalties)) - def get_penalty(self, value: Tuple[str, str], default: float = 1000.0) -> float: """ Get the penalty for the given value. Returns the given default if the value does not exist. @@ -69,7 +65,6 @@ class WeightedCategories: pass return default - def sql_restrict(self, table: SaFromClause) -> SaExpression: """ Return an SQLAlcheny expression that restricts the class and type columns of the given table to the values @@ -125,7 +120,6 @@ class FieldRanking: ranking.penalty -= min_penalty return min_penalty - def sql_penalty(self, table: SaFromClause) -> SaColumn: """ Create an SQL expression for the rankings. """ @@ -177,7 +171,6 @@ class SearchData: qualifiers: WeightedCategories = WeightedCategories([], []) - def set_strings(self, field: str, tokens: List[Token]) -> None: """ Set on of the WeightedStrings properties from the given token list. Adapt the global penalty, so that the @@ -191,7 +184,6 @@ class SearchData: setattr(self, field, wstrs) - def set_qualifiers(self, tokens: List[Token]) -> None: """ Set the qulaifier field from the given tokens. """ @@ -207,7 +199,6 @@ class SearchData: self.qualifiers = WeightedCategories(list(categories.keys()), list(categories.values())) - def set_ranking(self, rankings: List[FieldRanking]) -> None: """ Set the list of rankings and normalize the ranking. """