mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
disallow category tokens in the middle of a query string
This already worked for left-to-right readings and now is also implemented for right-to-left reading. A qualifier must always be before or after the name.
This commit is contained in:
@@ -132,6 +132,11 @@ class _TokenSequence:
|
||||
|
||||
# Name tokens are always acceptable and don't change direction
|
||||
if ttype == qmod.TokenType.PARTIAL:
|
||||
# qualifiers cannot appear in the middle of the qeury. They need
|
||||
# to be near the next phrase.
|
||||
if self.direction == -1 \
|
||||
and any(t.ttype == qmod.TokenType.QUALIFIER for t in self.seq[:-1]):
|
||||
return None
|
||||
return self.direction
|
||||
|
||||
# Other tokens may only appear once
|
||||
|
||||
Reference in New Issue
Block a user