Sha256: cffcb8f039b3d7b462248b1a448292d412bcd5e385e3297e8eb29f3378e043ea

Contents?: true

Size: 573 Bytes

Versions: 11

Compression:

Stored size: 573 Bytes

Contents

module ActiveFedora
  module Calculations
    # Get a count of the number of objects from solr
    # Takes :conditions as an argument
    def count(*args)
      return apply_finder_options(args.first).count if args.any?
      opts = {}
      opts[:rows] = limit_value if limit_value
      opts[:sort] = order_values if order_values

      calculate :count, where_values, opts
    end

    def calculate(_calculation, conditions, _opts = {})
      SolrService.query(create_query(conditions), raw: true, rows: 0).fetch('response'.freeze)['numFound'.freeze]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-9.7.3 lib/active_fedora/relation/calculations.rb
active-fedora-9.7.2 lib/active_fedora/relation/calculations.rb
active-fedora-9.9.1 lib/active_fedora/relation/calculations.rb
active-fedora-9.9.0 lib/active_fedora/relation/calculations.rb
active-fedora-9.8.2 lib/active_fedora/relation/calculations.rb
active-fedora-9.8.1 lib/active_fedora/relation/calculations.rb
active-fedora-9.8.0 lib/active_fedora/relation/calculations.rb
active-fedora-9.7.1 lib/active_fedora/relation/calculations.rb
active-fedora-9.7.0 lib/active_fedora/relation/calculations.rb
active-fedora-9.6.2 lib/active_fedora/relation/calculations.rb
active-fedora-9.6.1 lib/active_fedora/relation/calculations.rb