Sha256: 08f07cda6f206b6cd63b7d8ca8e9e7b9fe10fb3d6dfd2bce5e4f9706b2abe429
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module Scrivito 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 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 |
---|---|
scrivito_sdk-0.16.0 | lib/scrivito/obj_search_builder.rb |