if (base.postcode.start == 0 and self.direction != -1)\
or (base.postcode.end == query.num_token_slots() and self.direction != 1):
log().comment('postcode search')
- yield dataclasses.replace(base, penalty=self.penalty)
+ # <address>,<postcode> should give preference to address search
+ if base.postcode.start == 0:
+ penalty = self.penalty
+ else:
+ penalty = self.penalty + 0.1
+ yield dataclasses.replace(base, penalty=penalty)
# Postcode or country-only search
if not base.address:
log().comment('postcode/country search')
yield dataclasses.replace(base, penalty=self.penalty)
else:
+ # <postcode>,<address> should give preference to postcode search
+ if base.postcode and base.postcode.start == 0:
+ self.penalty += 0.1
# Use entire first word as name
if self.direction != -1:
log().comment('first word = name')
penalty=self.penalty,
address=base.address[:-1])
+ # variant for special housenumber searches
+ if base.housenumber:
+ yield dataclasses.replace(base, penalty=self.penalty)
+
# Use beginning of first word as name
if self.direction != -1:
first = base.address[0]