Skip to content

Commit

Permalink
Add default LIMIT 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
moseshll committed Dec 4, 2023
1 parent dba7103 commit bda0c55
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rights_api/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module RightsAPI
class Query
DEFAULT_LIMIT = 1000
attr_reader :schema

def initialize(schema:)
Expand All @@ -18,6 +19,7 @@ def run(id:)
dataset = dataset.where(where)
end
dataset = dataset.order(schema.default_order)
.limit(DEFAULT_LIMIT)
result = Result.new(total: dataset.count)
dataset.each do |row|
result.add! row: @schema.normalize_row(row)
Expand Down

0 comments on commit bda0c55

Please sign in to comment.