Permalink
Browse files

fixed last bugs

  • Loading branch information...
1 parent 8282c34 commit 9696e63690e31e9d5493046a929cc0ae958082d7 Ignacio Perez committed Dec 30, 2010
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/indextank/index.rb
View
@@ -86,23 +86,23 @@ def search(query, options = {})
if options[:docvar_filters]
# go from { 3 => [ [1, 3], [5, nil] ]} to filter_docvar3 => 1:3,5:*
options[:docvar_filters].each_pair { |k, v|
- v.each { |val|
+ rng = v.map { |val|
raise ArgumentError, "using a range with bound count != 2" unless val.length == 2
- rng = "#{val[0] || '*'}:#{val[1] || '*'}"
- options.merge!( :"filter_docvar#{k}" => rng )
- }
+ "#{val[0] || '*'}:#{val[1] || '*'}"
+ }.join ","
+ options.merge!( :"filter_docvar#{k}" => rng )
}
options.delete :docvar_filters
end
if options[:function_filters]
# go from { 2 => [ [1 , 3],[5,8] ]} to filter_function2 => 1:3,5:8
options[:function_filters].each_pair { |k, v|
- v.each { |rng|
- raise ArgumentError, "using a range with bound count != 2" unless rng.length == 2
- rng = "#{v[0] || '*'}:#{v[1] || '*'}"
- options.merge!( :"filter_function#{k}" => rng )
- }
+ rng = v.map { |val|
+ raise ArgumentError, "using a range with bound count != 2" unless val.length == 2
+ "#{val[0] || '*'}:#{val[1] || '*'}"
+ }.join ","
+ options.merge!( :"filter_function#{k}" => rng )
}
options.delete :function_filters
end

0 comments on commit 9696e63

Please sign in to comment.