lib/builder/mongo_helpers.rb in sinatra_resource-0.4.3 vs lib/builder/mongo_helpers.rb in sinatra_resource-0.4.4
- old
+ new
@@ -307,17 +307,10 @@
update_document!(child_model, child_id)
end
end
protected
-
- PATTERNS = [
- [ %r{^<=(.*)} , '$lte' ],
- [ %r{^<(.*)} , '$lt' ],
- [ %r{^>=(.*)} , '$gte' ],
- [ %r{^>(.*)} , '$gt' ]
- ]
QS_FILTER = QueryStringFilter.new
# Build conditions hash based on +params+.
#
@@ -331,10 +324,10 @@
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 }
+ { :_keywords => search_string.downcase }
elsif filter_string
unsafe = QS_FILTER.parse(filter_string)
sanitize(unsafe, model)
else
{}