+2
-2
app/query_parser.rb
+2
-2
app/query_parser.rb
···
7
7
8
8
while match = query.match(/".+?"/)
9
9
range = match.begin(0)...match.end(0)
10
-
phrase = query[range][1..-2].strip
10
+
phrase = query[range][1..-2].gsub(/[\W_]+/, ' ').strip
11
11
query[range] = ' '
12
12
@terms << phrase
13
13
end
14
14
15
-
@terms += query.split(/ +/)
15
+
@terms += query.gsub(/[\W_]+/, ' ').strip.split(/ +/)
16
16
end
17
17
end