]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/api/search/test_icu_query_analyzer.py
interpret stand-alone special terms always as near term
[nominatim.git] / test / python / api / search / test_icu_query_analyzer.py
index 6a17e32abab37475d8ab5178d2a5ee5fc2fffe1e..2ec3a7fecc85715536241b9b7d6c25c056427cd2 100644 (file)
@@ -138,6 +138,19 @@ async def test_category_words_only_at_beginning(conn):
     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)