active_fedora icon indicating copy to clipboard operation
active_fedora copied to clipboard

Use lazy Solr results in CollectionAssociation#find_target

Open botimer opened this issue 7 years ago • 0 comments

Per https://github.com/samvera/active_fedora/blob/fe9ca1cd07031c1423c2e37f3d5bd0e96e4fb6d0/lib/active_fedora/associations/collection_association.rb#L302,

        def find_target
          # TODO: don't reify, just store the solr results and lazily reify.
          # For now, we set a hard limit of 1000 results.
          records = ActiveFedora::QueryResultBuilder.reify_solr_results(load_from_solr(rows: SolrService::MAX_ROWS))
          records.each { |record| set_inverse_instance(record) }
          records
        rescue ObjectNotFoundError, Ldp::Gone => e
          ActiveFedora::Base.logger.error "Solr and Fedora may be out of sync:\n" + e.message
          reset
          []
        end

botimer avatar Sep 19 '18 19:09 botimer