Sha256: fd47ff0cb3508c12aa380db5ab683a4fe8bb795a89564af02125b7dd69916a2a
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module RailsConnector class ObjSearchBuilder < Struct.new(:query) def build reset_enumerator set_predicates set_offset set_order set_batch_size set_format set_include_deleted enumerator end private def reset_enumerator @enumerator = nil end def enumerator @enumerator ||= ObjSearchEnumerator.new(nil) end def set_predicates query[:predicates].each do |p| if p[:negate] enumerator.and_not(p[:field], p[:operator], p[:value]) else enumerator.and(p[:field], p[:operator], p[:value], p[:boost]) end end end def set_offset enumerator.offset(query[:offset].to_i) if query[:offset] end def set_order enumerator.order(query[:order]) if query[:order] enumerator.reverse_order if query[:reverse_order] end def set_batch_size enumerator.batch_size(query[:batch_size]) if query[:batch_size] end def set_format enumerator.format(query[:format]) if query[:format] end def set_include_deleted enumerator.include_deleted if query[:include_deleted] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
infopark_cloud_connector-7.1.0 | lib/rails_connector/obj_search_builder.rb |