class Ddr::Index::Query

Public Class Methods

build(*args, &block) click to toggle source
# File lib/ddr/index/query.rb, line 19
def self.build(*args, &block)
  new.tap do |query|
    query.build(*args, &block)
  end
end
new(**args, &block) click to toggle source
Calls superclass method
# File lib/ddr/index/query.rb, line 25
def initialize(**args, &block)
  super(**args)
  if block_given?
    build(&block)
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/ddr/index/query.rb, line 72
def ==(other)
  other.instance_of?(self.class) &&
    other.q == self.q &&
    other.fields == self.fields &&
    other.filters == self.filters &&
    other.rows == self.rows &&
    other.sort == self.sort
end
build(*args, &block) click to toggle source
# File lib/ddr/index/query.rb, line 67
def build(*args, &block)
  QueryBuilder.new(self, *args, &block)
  self
end
csv() click to toggle source
# File lib/ddr/index/query.rb, line 55
def csv
  CSVQueryResult.new(self)
end
each_pid(&block) click to toggle source
# File lib/ddr/index/query.rb, line 46
def each_pid(&block)
  Deprecation.warn(QueryResult, "`each_pid` is deprecated; use `each_id` instead.")
  each_id(&block)
end
filter_clauses() click to toggle source
# File lib/ddr/index/query.rb, line 59
def filter_clauses
  filters.map(&:clauses).flatten
end
inspect() click to toggle source
# File lib/ddr/index/query.rb, line 32
def inspect
  "#<#{self.class.name} q=#{q.inspect}, filters=#{filters.inspect}," \
  " sort=#{sort.inspect}, rows=#{rows.inspect}, fields=#{fields.inspect}>"
end
pids() click to toggle source
# File lib/ddr/index/query.rb, line 41
def pids
  Deprecation.warn(QueryResult, "`pids` is deprecated; use `ids` instead.")
  ids
end
query_params() click to toggle source
# File lib/ddr/index/query.rb, line 63
def query_params
  QueryParams.new(self)
end
result() click to toggle source
# File lib/ddr/index/query.rb, line 51
def result
  QueryResult.new(self)
end
to_s() click to toggle source
# File lib/ddr/index/query.rb, line 37
def to_s
  URI.encode_www_form(params)
end