remove importance fallbacks in search queries

This commit is contained in:
Sarah Hoffmann
2026-03-02 10:09:57 +01:00
parent a16c698fb2
commit 46dfb12844
2 changed files with 4 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
# #
# This file is part of Nominatim. (https://nominatim.org) # This file is part of Nominatim. (https://nominatim.org)
# #
# Copyright (C) 2025 by the Nominatim developer community. # Copyright (C) 2026 by the Nominatim developer community.
# For a full list of authors see the git log. # For a full list of authors see the git log.
""" """
Implementation of search for an address (search with housenumber). Implementation of search for an address (search with housenumber).
@@ -158,10 +158,7 @@ class AddressSearch(base.AbstractSearch):
sql = sa.select(t.c.place_id, t.c.search_rank, t.c.address_rank, sql = sa.select(t.c.place_id, t.c.search_rank, t.c.address_rank,
t.c.country_code, t.c.centroid, t.c.country_code, t.c.centroid,
t.c.name_vector, t.c.nameaddress_vector, t.c.name_vector, t.c.nameaddress_vector,
sa.case((t.c.importance > 0, t.c.importance), t.c.importance, penalty.label('penalty'))
else_=0.40001-(sa.cast(t.c.search_rank, sa.Float())/75))
.label('importance'),
penalty.label('penalty'))
for lookup in self.lookups: for lookup in self.lookups:
sql = sql.where(lookup.sql_condition(t)) sql = sql.where(lookup.sql_condition(t))

View File

@@ -2,7 +2,7 @@
# #
# This file is part of Nominatim. (https://nominatim.org) # This file is part of Nominatim. (https://nominatim.org)
# #
# Copyright (C) 2025 by the Nominatim developer community. # Copyright (C) 2026 by the Nominatim developer community.
# For a full list of authors see the git log. # For a full list of authors see the git log.
""" """
Implementation of search for a named place (without housenumber). Implementation of search for a named place (without housenumber).
@@ -61,9 +61,7 @@ class PlaceSearch(base.AbstractSearch):
sql = sa.select(t.c.place_id, t.c.search_rank, t.c.address_rank, sql = sa.select(t.c.place_id, t.c.search_rank, t.c.address_rank,
t.c.country_code, t.c.centroid, t.c.country_code, t.c.centroid,
t.c.name_vector, t.c.nameaddress_vector, t.c.name_vector, t.c.nameaddress_vector,
sa.case((t.c.importance > 0, t.c.importance), t.c.importance)
else_=0.40001-(sa.cast(t.c.search_rank, sa.Float())/75))
.label('importance'))
for lookup in self.lookups: for lookup in self.lookups:
sql = sql.where(lookup.sql_condition(t)) sql = sql.where(lookup.sql_condition(t))