Skip to content

Commit

Permalink
fixed last bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Perez committed Dec 30, 2010
1 parent 8282c34 commit 9696e63
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/indextank/index.rb
Expand Up @@ -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
Expand Down

0 comments on commit 9696e63

Please sign in to comment.