From c2569d090d2c9a510ba8c589a10ade1d0262022e Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Tue, 31 Jul 2012 18:13:37 +0100 Subject: [PATCH] support nested query --- lib/tire/search/query.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tire/search/query.rb b/lib/tire/search/query.rb index 930b4df0..cfef2447 100644 --- a/lib/tire/search/query.rb +++ b/lib/tire/search/query.rb @@ -34,7 +34,13 @@ def string(value, options={}) @value end - + def nested(options={},&block) + @nested ||= Query.new(&block) + @value[:nested] = options + @value[:nested].update({:query => @nested.to_hash}) + @value + end + def custom_filters_score(options={}, &block) @custom_filters ||= CustomFiltersScoreQuery.new(options) block.arity < 1 ? @custom_filters.instance_eval(&block) : block.call(@custom_filters) if block_given?