Fixes #3298.
if trange.start == 0:
query.add_token(trange, qmod.TokenType.NEAR_ITEM, token)
else:
- query.add_token(trange, qmod.TokenType.QUALIFIER, token)
+ if trange.start == 0 and trange.end == query.num_token_slots():
+ query.add_token(trange, qmod.TokenType.NEAR_ITEM, token)
+ else:
+ query.add_token(trange, qmod.TokenType.QUALIFIER, token)
else:
query.add_token(trange, DB_TO_TOKEN_TYPE[row.type], token)
| class | type |
| leisure | firepit |
+
+ Scenario: POI search in a bounded viewbox
+ When sending json search query "restaurants"
+ | viewbox | bounded |
+ | 9.50830,47.15253,9.52043,47.14866 | 1 |
+ Then results contain
+ | class | type |
+ | amenity | restaurant |
+
Scenario Outline: Key/value search near given coordinate can be restricted to country
When sending json search query "[natural=peak] 47.06512,9.53965" with address
| countrycodes |
assert not query.nodes[2].starting
+@pytest.mark.asyncio
+async def test_freestanding_qualifier_words_become_category(conn):
+ ana = await tok.create_query_analyzer(conn)
+
+ await add_word(conn, 1, 'foo', 'S', 'FOO', {'op': '-'})
+
+ query = await ana.analyze_query(make_phrase('foo'))
+
+ assert query.num_token_slots() == 1
+ assert len(query.nodes[0].starting) == 1
+ assert query.nodes[0].starting[0].ttype == TokenType.NEAR_ITEM
+
+
@pytest.mark.asyncio
async def test_qualifier_words(conn):
ana = await tok.create_query_analyzer(conn)