limit to the configured number of results.
"""
if results:
- results.sort(key=lambda r: r.ranking)
+ results.sort(key=lambda r: (r.ranking, 0 if r.bbox is None else -r.bbox.area))
min_rank = results[0].rank_search
min_ranking = results[0].ranking
results = SearchResults(r for r in results
"""
assert self.query_analyzer is not None
qwords = [word for phrase in query.source
- for word in re.split('[, ]+', phrase.text) if word]
+ for word in re.split('[-,: ]+', phrase.text) if word]
if not qwords:
return
distance = 0.0
norm = self.query_analyzer.normalize_text(' '.join((result.display_name,
result.country_code or '')))
- words = set((w for w in norm.split(' ') if w))
+ words = set((w for w in re.split('[-,: ]+', norm) if w))
if not words:
continue
for qword in qwords: