app/presenters/hyrax/member_presenter_factory.rb
# These are the file sets that belong to this work, but not necessarily
# in order.
# Arbitrarily maxed at 10 thousand; had to specify rows due to solr's default of 10
These are the file sets that belong to this work, but not necessarily
in order.
Arbitrarily maxed at 10 thousand; had to specify rows due to solr's default of 10
These are the file sets that belong to this work but not necessarily in order . Arbitrarily maxed at 10 thousand ; had to specify rows due to solr ' s default of 10
def file_set_ids
      	        @file_set_ids ||= begin
                            ActiveFedora::SolrService.query("{!field f=has_model_ssim}FileSet",
                                                            rows: 10_000,
                                                            fl: ActiveFedora.id_field,
                                                            fq: "{!join from=ordered_targets_ssim to=id}id:\"#{id}/list_source\"")
                                                     .flat_map { |x| x.fetch(ActiveFedora.id_field, []) }
                          end
        source_ids = @work.class.to_s.include?("SolrDocument") ? @work._source['file_set_ids_ssim'] : @work.file_set_ids
        if source_ids.nil? 
          solr = RSolr.connect url: Account.find_by(tenant: Apartment::Tenant.current).solr_endpoint.url
          response = solr.get 'select', params: {
            q: "*:*",
            rows: 10_000,
            fl: "member_ids_ssim",
            fq: "id:\"#{id}\""
          }
          unless response['response']['docs'].empty? || response['response']['docs'][0].empty?
          	@file_set_ids = response['response']['docs'][0]['file_set_ids_ssim']
          else
          	@file_set_ids
          end
        elsif source_ids.sort != @file_set_ids.sort
          @file_set_ids = source_ids
        else
          @file_set_ids
        end
      end
def file_set_ids @file_set_ids ||= begin ActiveFedora :: SolrService . query ( "{!field f=has_model_ssim}FileSet" , rows : 10_000 , fl : ActiveFedora . id_field , fq : "{!join from=ordered_targets_ssim to=id}id:\"#{id}/list_source\"" ) . flat_map { | x | x . fetch ( ActiveFedora . id_field , [ ] ) } end source_ids = @work . class . to_s . include? ( "SolrDocument" ) ? @work . _source [ 'file_set_ids_ssim' ] : @work . file_set_ids if source_ids . nil? solr = RSolr . connect url : Account . find_by ( tenant : Apartment :: Tenant . current ) . solr_endpoint . url response = solr . get 'select' , params : { q : "*:*" , rows : 10_000 , fl : "member_ids_ssim" , fq : "id:\"#{id}\"" } unless response [ 'response' ] [ 'docs' ] . empty? || response [ 'response' ] [ 'docs' ] [ 0 ] . empty? @file_set_ids = response [ 'response' ] [ 'docs' ] [ 0 ] [ 'file_set_ids_ssim' ] else @file_set_ids end elsif source_ids . sort != @file_set_ids . sort @file_set_ids = source_ids else @file_set_ids end end
These are the file sets that belong to this work, but not necessarily
in order.
These are the file sets that belong to this work but not necessarily in order .
# If Solr (source_ids) doesn't have the same contents as ActiveFedora::SolrService (@file_set_ids) # || (source_ids.length > @file_set_ids.length) #"http://perdita.library.uvic.ca:8983/solr/25e3429b-34de-4bbc-aa3e-167cc6ddde64"