Class: Hyrax::FindObjectsViaSolrService Deprecated

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/find_objects_via_solr_service.rb

Overview

Deprecated.

This class is being replaced by Hyrax::SolrQueryService #get_objects method.

Methods in this class search solr to get the ids and then use the query service to find the objects.

Class Method Summary collapse

Class Method Details

.find_for_model_by_field_pairs(model:, field_pairs:, join_with: ' OR ', type: 'field', use_valkyrie: Hyrax.config.use_valkyrie?) ⇒ Array<ActiveFedora::Base|Valkyrie::Resource>

Find objects matching search criteria.

Parameters:

  • model (Class)

    if not using Valkyrie, this is expected to be an ActiveFedora::Base object that supports #where

  • field_pairs (Hash)

    a list of pairs of property name and values

  • join_with (String) (defaults to: ' OR ')

    the value we’re joining the clauses with (default: ‘ OR ’ for backward compatibility with ActiveFedora where)

  • type (String) (defaults to: 'field')

    The type of query to run. Either ‘raw’ or ‘field’ (default: ‘field’)

  • use_valkyrie (Boolean) (defaults to: Hyrax.config.use_valkyrie?)

    if true, return Valkyrie resource(s); otherwise, return ActiveFedora object(s)

Returns:



20
21
22
23
24
25
26
27
28
# File 'app/services/hyrax/find_objects_via_solr_service.rb', line 20

def find_for_model_by_field_pairs(model:, field_pairs:, join_with: ' OR ', type: 'field', use_valkyrie: Hyrax.config.use_valkyrie?)
  Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0.  " \
                   "Instead, use 'Hyrax::SolrQueryService.new.with_model(...).with_field_pairs(...).get_objects'.")

  solr_query_builder.new
                    .with_model(model: model)
                    .with_field_pairs(field_pairs: field_pairs, join_with: join_with, type: type)
                    .get_objects(use_valkyrie: use_valkyrie).to_a
end