Class: Valkyrie::Persistence::Solr::Queries::FindInverseReferencesQuery
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Solr::Queries::FindInverseReferencesQuery
- Defined in:
- lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb
Overview
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#resource_factory ⇒ Object
readonly
Returns the value of attribute resource_factory.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(resource:, property:, connection:, resource_factory:) ⇒ FindInverseReferencesQuery
constructor
A new instance of FindInverseReferencesQuery.
- #query ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(resource:, property:, connection:, resource_factory:) ⇒ FindInverseReferencesQuery
Returns a new instance of FindInverseReferencesQuery.
7 8 9 10 11 12 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 7 def initialize(resource:, property:, connection:, resource_factory:) @resource = resource @property = property @connection = connection @resource_factory = resource_factory end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 6 def connection @connection end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
6 7 8 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 6 def property @property end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 6 def resource @resource end |
#resource_factory ⇒ Object (readonly)
Returns the value of attribute resource_factory.
6 7 8 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 6 def resource_factory @resource_factory end |
Instance Method Details
#each ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 18 def each docs = DefaultPaginator.new while docs.has_next? docs = connection.paginate(docs.next_page, docs.per_page, "select", params: { q: query })["response"]["docs"] docs.each do |doc| yield resource_factory.to_resource(object: doc) end end end |
#query ⇒ Object
28 29 30 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 28 def query "#{property}_ssim:id-#{resource.id}" end |
#run ⇒ Object
14 15 16 |
# File 'lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb', line 14 def run enum_for(:each) end |