lib/ddr/index/query_builder.rb in ddr-models-3.0.0.beta.7 vs lib/ddr/index/query_builder.rb in ddr-models-3.0.0.beta.8
- old
+ new
@@ -89,22 +89,10 @@
# If a hash value is an array, that query clause will select documents
# where the field matches any array entry.
#
class QueryBuilder
- # Builds a Query object
- # @yield [builder] a new QueryBuilder instance.
- # @return [Query]
- def self.build
- Deprecation.warn(self,
- "`Ddr::Index::QueryBuilder.build` is deprecated and will be removed in ddr-models 3.0." \
- " Use `Ddr::Index::QueryBuilder.new` instead.")
- builder = new
- yield builder
- builder.query
- end
-
attr_reader :query
def initialize(query = nil, &block)
@query = query || Query.new
if block_given?
@@ -144,14 +132,9 @@
alias_method :rows, :limit
# @param orderings [Hash<Field, String>]
# @return [QueryBuilder] self
def order_by(*orderings)
- unless orderings.first.is_a? Hash
- Deprecation.warn(QueryBuilder, "`order_by` will require a hash of orderings in ddr-models 3.0.")
- field, order = orderings
- return order_by(field => order)
- end
query.sort += orderings.first.map { |field, order| SortOrder.new(field: field, order: order) }
self
end
alias_method :sort, :order_by