FIX: search within topic not working correctly in CJK

We were splitting the term prior to search causing everything to miss
This commit is contained in:
Sam
2018-11-07 09:41:55 +11:00
parent 30501b6660
commit 06b9d8223a
2 changed files with 29 additions and 14 deletions

View File

@@ -246,10 +246,19 @@ describe Search do
context 'search within topic' do
def new_post(raw, topic)
def new_post(raw, topic = nil)
topic ||= Fabricate(:topic)
Fabricate(:post, topic: topic, topic_id: topic.id, user: topic.user, raw: raw)
end
it 'works in Chinese' do
SiteSetting.search_tokenize_chinese_japanese_korean = true
post = new_post('I am not in English 何点になると思いますか')
results = Search.execute('何点になると思', search_context: post.topic)
expect(results.posts.map(&:id)).to eq([post.id])
end
it 'displays multiple results within a topic' do
topic = Fabricate(:topic)
topic2 = Fabricate(:topic)