diff --git a/src/tribler/core/components/metadata_store/restapi/tests/test_search_endpoint.py b/src/tribler/core/components/metadata_store/restapi/tests/test_search_endpoint.py index 27fa0ead6be..ea2e4cda8cd 100644 --- a/src/tribler/core/components/metadata_store/restapi/tests/test_search_endpoint.py +++ b/src/tribler/core/components/metadata_store/restapi/tests/test_search_endpoint.py @@ -147,21 +147,21 @@ async def test_search_with_space(rest_api, metadata_store): metadata_store.TorrentMetadata(title='abc defxyz', infohash=random_infohash()) s1 = to_fts_query("abc") - assert s1 == '"abc"*' + assert s1 == '"abc"' s2 = to_fts_query("abc def") - assert s2 == '"abc" "def"*' + assert s2 == '"abc" "def"' ss2 = to_fts_query(s2) assert ss2 == s2 parsed = await do_request(rest_api, f'search?txt_filter={s1}', expected_code=200) results = {item["name"] for item in parsed["results"]} - assert results == {'abc', 'abc.def', 'abc def', 'abc defxyz', 'abcxyz def'} + assert results == {'abc', 'abc.def', 'abc def', 'abc defxyz'} parsed = await do_request(rest_api, f'search?txt_filter={s2}', expected_code=200) results = {item["name"] for item in parsed["results"]} - assert results == {'abc.def', 'abc def', 'abc defxyz'} # but not 'abcxyz def' + assert results == {'abc.def', 'abc def'} # but not 'abcxyz def' async def test_single_snippet_in_search(rest_api, metadata_store, knowledge_db): diff --git a/src/tribler/core/utilities/tests/test_utilities.py b/src/tribler/core/utilities/tests/test_utilities.py index 4273445496d..d1533b83fc5 100644 --- a/src/tribler/core/utilities/tests/test_utilities.py +++ b/src/tribler/core/utilities/tests/test_utilities.py @@ -135,9 +135,9 @@ def test_to_fts_query(): assert to_fts_query(None) is None assert to_fts_query('') is None assert to_fts_query(' ') is None - assert to_fts_query(' abc') == '"abc"*' - assert to_fts_query('abc def') == '"abc" "def"*' - assert to_fts_query('[abc, def]: xyz?!') == '"abc" "def" "xyz"*' + assert to_fts_query(' abc') == '"abc"' + assert to_fts_query('abc def') == '"abc" "def"' + assert to_fts_query('[abc, def]: xyz?!') == '"abc" "def" "xyz"' def test_extract_tags(): diff --git a/src/tribler/core/utilities/utilities.py b/src/tribler/core/utilities/utilities.py index 1de9bf43193..db96248cf98 100644 --- a/src/tribler/core/utilities/utilities.py +++ b/src/tribler/core/utilities/utilities.py @@ -242,7 +242,7 @@ def to_fts_query(text): if not words: return None - return ' '.join(words) + '*' + return ' '.join(words) def show_system_popup(title, text):