Fixed: can not search for 2 letters word (#4381).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3306 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d7c9886b8c
commit
fe7d65922b
|
@ -62,8 +62,8 @@ class SearchController < ApplicationController
|
||||||
# extract tokens from the question
|
# extract tokens from the question
|
||||||
# eg. hello "bye bye" => ["hello", "bye bye"]
|
# eg. hello "bye bye" => ["hello", "bye bye"]
|
||||||
@tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}
|
@tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}
|
||||||
# tokens must be at least 3 character long
|
# tokens must be at least 2 characters long
|
||||||
@tokens = @tokens.uniq.select {|w| w.length > 2 }
|
@tokens = @tokens.uniq.select {|w| w.length > 1 }
|
||||||
|
|
||||||
if !@tokens.empty?
|
if !@tokens.empty?
|
||||||
# no more than 5 tokens to search for
|
# no more than 5 tokens to search for
|
||||||
|
|
Loading…
Reference in New Issue