Skip to content

Commit 18238fe

Browse files
authored
add func.to_tsquery (#848)
1 parent ea5cdc4 commit 18238fe

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

store/neurostore/resources/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def search(self):
619619
validate_search_query(s)
620620
except errors.SyntaxError as e:
621621
abort(400, description=e.args[0])
622-
tsquery = pubmed_to_tsquery(s)
622+
tsquery = func.to_tsquery('english', pubmed_to_tsquery(s))
623623
q = q.filter(m._ts_vector.op("@@")(tsquery))
624624

625625
# Alternatively (or in addition), search on individual fields.

store/neurostore/tests/api/test_query_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ def test_multiword_queries(auth_client, ingest_neurosynth, session):
9797

9898
single_word_search = auth_client.get(f"/api/studies/?search={single_word}")
9999
assert single_word_search.status_code == 200
100+
assert len(single_word_search.json()["results"]) > 0
100101

101102
multi_word_search = auth_client.get(f"/api/studies/?search={multiple_words}")
102103
assert multi_word_search.status_code == 200
104+
assert len(multi_word_search.json()["results"]) > 0
103105

104106

105107
@pytest.mark.parametrize("query, expected", valid_queries)

0 commit comments

Comments
 (0)