Sha256: 6ac1d00d77e8db789456b60c4a6f9f45954365b3ad14bd0e3141eab6b4021d49
Contents?: true
Size: 1017 Bytes
Versions: 40
Compression:
Stored size: 1017 Bytes
Contents
module Scrivito class ObjSearchBuilder < Struct.new(:query) def build reset_enumerator set_predicates set_offset set_order set_batch_size set_include_deleted enumerator end private def reset_enumerator @enumerator = nil end def enumerator @enumerator ||= ObjSearchEnumerator.new(Workspace.current) 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_include_deleted enumerator.include_deleted if query[:include_deleted] end end end
Version data entries
40 entries across 40 versions & 1 rubygems