Skip to content

Commit

Permalink
enable filtering by registrant
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Oct 7, 2019
1 parent b124525 commit b8857a3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,17 @@ def self.update_registrant(options={})
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || [])
# ra = options[:ra] || "crossref"
source_id = options[:source_id] || "datacite-crossref,crossref"
source_id = options[:source_id] || "datacite-crossref"
citation_type = options[:citation_type] || "Dataset-ScholarlyArticle"
query = options[:query] || "registrant_id:*crossref.citations"

response = Event.query(nil, source_id: source_id, citation_type: citation_type, page: { size: 1, cursor: cursor })
response = Event.query(query, source_id: source_id, citation_type: citation_type, page: { size: 1, cursor: cursor })
logger.info "[Update] #{response.results.total} events for sources #{source_id}."

# walk through results using cursor
if response.results.total > 0
while response.results.results.length > 0 do
response = Event.query(nil, source_id: source_id, citation_type: citation_type, page: { size: size, cursor: cursor })
response = Event.query(query, source_id: source_id, citation_type: citation_type, page: { size: size, cursor: cursor })
break unless response.results.results.length > 0

logger.info "[Update] Updating #{response.results.results.length} #{source_id} events starting with _id #{response.results.to_a.first[:_id]}."
Expand Down

0 comments on commit b8857a3

Please sign in to comment.