diff --git a/lib/search.rb b/lib/search.rb index 38024cfcd..007aa7a2d 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -178,7 +178,7 @@ class Search @valid = false return end - @term = terms.join(' ') + @term = terms.join(' ') if @term.include?(' ') end # If the term is a number or url to a topic, just include that topic diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index f7dac7167..287676e16 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -413,6 +413,7 @@ describe Search do skip("skipped until pg app installs the db correctly") if RbConfig::CONFIG["arch"] =~ /darwin/ SiteSetting.default_locale = 'zh_TW' + SiteSetting.min_search_term_length = 1 topic = Fabricate(:topic, title: 'My Title Discourse社區指南') post = Fabricate(:post, topic: topic) @@ -424,6 +425,7 @@ describe Search do skip("skipped until pg app installs the db correctly") if RbConfig::CONFIG["arch"] =~ /darwin/ SiteSetting.search_tokenize_chinese_japanese_korean = true + SiteSetting.min_search_term_length = 1 topic = Fabricate(:topic, title: 'My Title Discourse社區指南') post = Fabricate(:post, topic: topic)