lib/builder/mongo_helpers.rb in sinatra_resource-0.4.17 vs lib/builder/mongo_helpers.rb in sinatra_resource-0.4.18
- old
+ new
@@ -367,10 +367,11 @@
search_string = params[SEARCH_KEY]
filter_string = params[FILTER_KEY]
if search_string && filter_string
error 400, convert(body_for(:invalid_params, [FILTER_KEY]))
elsif search_string
- { :_keywords => search_string.downcase }
+ words = search_string.downcase.split(" ")
+ { :_keywords => { '$all' => words } }
elsif filter_string
begin
unsafe = QS_FILTER.parse(filter_string)
sanitize(unsafe, model)
rescue QueryStringFilter::ParseError