lib/inquisitio/searcher.rb in inquisitio-1.3.1 vs lib/inquisitio/searcher.rb in inquisitio-1.4.0

- old
+ new

@@ -5,21 +5,22 @@ def self.method_missing(name, *args) Searcher.new.send(name, *args) end - attr_reader :params + attr_reader :params, :options def initialize(params = nil) @params = params || { criteria: [], filters: {}, per: 10, page: 1, returns: [], with: {}, - sort: {} + sort: {}, + q_options: {} } @failed_attempts = 0 yield(self) if block_given? end @@ -81,10 +82,16 @@ s.params[:criteria] << value end end end + def options(value) + clone do |s| + s.params[:q_options] = value + end + end + def per(value) clone do |s| s.params[:per] = value.to_i end end @@ -164,9 +171,10 @@ filters: params[:filters], arguments: params[:with], size: params[:per], start: params[:per] * (params[:page] - 1), sort: params[:sort], + q_options: params[:q_options], return_fields: return_fields ) end end