summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-11-30 15:42:30 +0000
committerGo MAEDA <maeda@farend.jp>2018-11-30 15:42:30 +0000
commite23b2023cbc0ac9f7d871156107556795859b05e (patch)
treebbd717c3d3cfd45a94796513fbe7421ef6f3c1d1 /lib
parent198212f991573308b74d93a1e524497dd222dfc4 (diff)
downloadredmine-e23b2023cbc0ac9f7d871156107556795859b05e.tar.gz
redmine-e23b2023cbc0ac9f7d871156107556795859b05e.zip
Allow single Chinese character as a search keyword (#30037).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17667 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/search.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/redmine/search.rb b/lib/redmine/search.rb
index 674022151..e88736f55 100644
--- a/lib/redmine/search.rb
+++ b/lib/redmine/search.rb
@@ -60,7 +60,8 @@ module Redmine
# eg. hello "bye bye" => ["hello", "bye bye"]
@tokens = @question.scan(%r{((\s|^)"[^"]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}
# tokens must be at least 2 characters long
- @tokens = @tokens.uniq.select {|w| w.length > 1 }
+ # but for Chinese characters (汉字/漢字), tokens can be one character
+ @tokens = @tokens.uniq.select {|w| w.length > 1 || w =~ /\p{Han}/ }
# no more than 5 tokens to search for
@tokens.slice! 5..-1
end