@@ -62,8 +62,8 class SearchController < ApplicationController | |||||
62 | # extract tokens from the question |
|
62 | # extract tokens from the question | |
63 | # eg. hello "bye bye" => ["hello", "bye bye"] |
|
63 | # eg. hello "bye bye" => ["hello", "bye bye"] | |
64 | @tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')} |
|
64 | @tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')} | |
65 |
# tokens must be at least |
|
65 | # tokens must be at least 2 characters long | |
66 |
@tokens = @tokens.uniq.select {|w| w.length > |
|
66 | @tokens = @tokens.uniq.select {|w| w.length > 1 } | |
67 |
|
67 | |||
68 | if !@tokens.empty? |
|
68 | if !@tokens.empty? | |
69 | # no more than 5 tokens to search for |
|
69 | # no more than 5 tokens to search for |
General Comments 0
You need to be logged in to leave comments.
Login now