From 8ed26e6bc4a86ffe78d22e246d2023f64c8a0e49 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Thu, 16 May 2019 11:49:06 +0200 Subject: [PATCH] use active record for elasticsearch results. #274 --- app/graphql/elasticsearch_loader.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/graphql/elasticsearch_loader.rb b/app/graphql/elasticsearch_loader.rb index 6a8714c90..c62611b80 100644 --- a/app/graphql/elasticsearch_loader.rb +++ b/app/graphql/elasticsearch_loader.rb @@ -6,7 +6,11 @@ def initialize(model) end def perform(ids) - @model.find_by_id(ids).results.each { |record| fulfill(record.uid, record) } + if @model.name == "Doi" + @model.find_by_id(ids).results.each { |record| fulfill(record.uid, record) } + else + @model.find_by_id(ids).records.each { |record| fulfill(record.uid, record) } + end ids.each { |id| fulfill(id, nil) unless fulfilled?(id) } end end