mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-26 14:36:23 +03:00
fix debug output for NearSearch
The search info is in a subsearch and was therefore not taken into account.
This commit is contained in:
parent
3d0bc85b4d
commit
38b2b8a143
@ -317,7 +317,7 @@ class PoiSearch(AbstractSearch):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, sdata: SearchData) -> None:
|
def __init__(self, sdata: SearchData) -> None:
|
||||||
super().__init__(sdata.penalty)
|
super().__init__(sdata.penalty)
|
||||||
self.categories = sdata.qualifiers
|
self.qualifiers = sdata.qualifiers
|
||||||
self.countries = sdata.countries
|
self.countries = sdata.countries
|
||||||
|
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ class PoiSearch(AbstractSearch):
|
|||||||
.order_by(t.c.centroid.ST_Distance(NEAR_PARAM)) \
|
.order_by(t.c.centroid.ST_Distance(NEAR_PARAM)) \
|
||||||
.limit(LIMIT_PARAM)
|
.limit(LIMIT_PARAM)
|
||||||
|
|
||||||
classtype = self.categories.values
|
classtype = self.qualifiers.values
|
||||||
if len(classtype) == 1:
|
if len(classtype) == 1:
|
||||||
cclass, ctype = classtype[0]
|
cclass, ctype = classtype[0]
|
||||||
sql: SaLambdaSelect = sa.lambda_stmt(lambda: _base_query()
|
sql: SaLambdaSelect = sa.lambda_stmt(lambda: _base_query()
|
||||||
@ -358,7 +358,7 @@ class PoiSearch(AbstractSearch):
|
|||||||
rows.extend(await conn.execute(sql, bind_params))
|
rows.extend(await conn.execute(sql, bind_params))
|
||||||
else:
|
else:
|
||||||
# use the class type tables
|
# use the class type tables
|
||||||
for category in self.categories.values:
|
for category in self.qualifiers.values:
|
||||||
table = await conn.get_class_table(*category)
|
table = await conn.get_class_table(*category)
|
||||||
if table is not None:
|
if table is not None:
|
||||||
sql = _select_placex(t)\
|
sql = _select_placex(t)\
|
||||||
@ -384,7 +384,7 @@ class PoiSearch(AbstractSearch):
|
|||||||
for row in rows:
|
for row in rows:
|
||||||
result = nres.create_from_placex_row(row, nres.SearchResult)
|
result = nres.create_from_placex_row(row, nres.SearchResult)
|
||||||
assert result
|
assert result
|
||||||
result.accuracy = self.penalty + self.categories.get_penalty((row.class_, row.type))
|
result.accuracy = self.penalty + self.qualifiers.get_penalty((row.class_, row.type))
|
||||||
result.bbox = Bbox.from_wkb(row.bbox)
|
result.bbox = Bbox.from_wkb(row.bbox)
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class ForwardGeocoder:
|
|||||||
# pylint: disable=invalid-name,too-many-locals
|
# pylint: disable=invalid-name,too-many-locals
|
||||||
def _dump_searches(searches: List[AbstractSearch], query: QueryStruct,
|
def _dump_searches(searches: List[AbstractSearch], query: QueryStruct,
|
||||||
start: int = 0) -> Iterator[Optional[List[Any]]]:
|
start: int = 0) -> Iterator[Optional[List[Any]]]:
|
||||||
yield ['Penalty', 'Lookups', 'Housenr', 'Postcode', 'Countries', 'Qualifier', 'Rankings']
|
yield ['Penalty', 'Lookups', 'Housenr', 'Postcode', 'Countries', 'Qualifier', 'Catgeory', 'Rankings']
|
||||||
|
|
||||||
def tk(tl: List[int]) -> str:
|
def tk(tl: List[int]) -> str:
|
||||||
tstr = [f"{query.find_lookup_word_by_id(t)}({t})" for t in tl]
|
tstr = [f"{query.find_lookup_word_by_id(t)}({t})" for t in tl]
|
||||||
@ -182,11 +182,18 @@ def _dump_searches(searches: List[AbstractSearch], query: QueryStruct,
|
|||||||
|
|
||||||
for search in searches[start:]:
|
for search in searches[start:]:
|
||||||
fields = ('lookups', 'rankings', 'countries', 'housenumbers',
|
fields = ('lookups', 'rankings', 'countries', 'housenumbers',
|
||||||
'postcodes', 'qualifier')
|
'postcodes', 'qualifiers')
|
||||||
iters = itertools.zip_longest([f"{search.penalty:.3g}"],
|
if hasattr(search, 'search'):
|
||||||
*(getattr(search, attr, []) for attr in fields),
|
iters = itertools.zip_longest([f"{search.penalty:.3g}"],
|
||||||
fillvalue= '')
|
*(getattr(search.search, attr, []) for attr in fields),
|
||||||
for penalty, lookup, rank, cc, hnr, pc, qual in iters:
|
getattr(search, 'categories', []),
|
||||||
|
fillvalue='')
|
||||||
|
else:
|
||||||
|
iters = itertools.zip_longest([f"{search.penalty:.3g}"],
|
||||||
|
*(getattr(search, attr, []) for attr in fields),
|
||||||
|
[],
|
||||||
|
fillvalue='')
|
||||||
|
for penalty, lookup, rank, cc, hnr, pc, qual, cat in iters:
|
||||||
yield [penalty, fmt_lookup(lookup), fmt_cstr(hnr),
|
yield [penalty, fmt_lookup(lookup), fmt_cstr(hnr),
|
||||||
fmt_cstr(pc), fmt_cstr(cc), fmt_cstr(qual), fmt_ranking(rank)]
|
fmt_cstr(pc), fmt_cstr(cc), fmt_cstr(qual), fmt_cstr(cat), fmt_ranking(rank)]
|
||||||
yield None
|
yield None
|
||||||
|
Loading…
Reference in New Issue
Block a user