active-fedora 9.13.0 → 10.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -19
  3. data/lib/active_fedora.rb +0 -17
  4. data/lib/active_fedora/associations.rb +0 -16
  5. data/lib/active_fedora/associations/builder/association.rb +3 -19
  6. data/lib/active_fedora/associations/builder/has_and_belongs_to_many.rb +1 -3
  7. data/lib/active_fedora/attached_files.rb +2 -108
  8. data/lib/active_fedora/attributes.rb +4 -100
  9. data/lib/active_fedora/core.rb +0 -6
  10. data/lib/active_fedora/datastreams.rb +0 -2
  11. data/lib/active_fedora/errors.rb +0 -9
  12. data/lib/active_fedora/file.rb +9 -22
  13. data/lib/active_fedora/file_configurator.rb +1 -32
  14. data/lib/active_fedora/identifiable.rb +0 -6
  15. data/lib/active_fedora/ldp_resource.rb +0 -12
  16. data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
  17. data/lib/active_fedora/query_result_builder.rb +0 -17
  18. data/lib/active_fedora/rdf/datastream_indexing.rb +0 -11
  19. data/lib/active_fedora/rdf/indexing_service.rb +1 -1
  20. data/lib/active_fedora/rdf/rdf_datastream.rb +0 -10
  21. data/lib/active_fedora/relation/finder_methods.rb +2 -21
  22. data/lib/active_fedora/solr_query_builder.rb +0 -16
  23. data/lib/active_fedora/solr_service.rb +2 -89
  24. data/lib/active_fedora/version.rb +1 -1
  25. data/lib/active_fedora/versionable.rb +0 -8
  26. data/spec/config_helper.rb +0 -4
  27. data/spec/integration/attached_files_spec.rb +1 -108
  28. data/spec/integration/attributes_spec.rb +14 -94
  29. data/spec/integration/direct_container_spec.rb +2 -2
  30. data/spec/integration/file_spec.rb +23 -13
  31. data/spec/integration/indexing_spec.rb +4 -4
  32. data/spec/integration/json_serialization_spec.rb +4 -57
  33. data/spec/integration/ntriples_datastream_spec.rb +77 -139
  34. data/spec/integration/relation_delegation_spec.rb +16 -18
  35. data/spec/integration/{model_spec.rb → scoping_spec.rb} +10 -14
  36. data/spec/integration/solr_hit_spec.rb +4 -20
  37. data/spec/integration/solr_instance_loader_spec.rb +1 -13
  38. data/spec/integration/versionable_spec.rb +0 -9
  39. data/spec/samples/models/mods_article.rb +1 -6
  40. data/spec/spec_helper.rb +0 -3
  41. data/spec/unit/attached_files_spec.rb +29 -127
  42. data/spec/unit/attributes_spec.rb +51 -475
  43. data/spec/unit/base_active_model_spec.rb +12 -47
  44. data/spec/unit/base_extra_spec.rb +1 -1
  45. data/spec/unit/code_configurator_spec.rb +2 -10
  46. data/spec/unit/core_spec.rb +3 -18
  47. data/spec/unit/file_configurator_spec.rb +0 -80
  48. data/spec/unit/file_spec.rb +0 -6
  49. data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -7
  50. data/spec/unit/inheritance_spec.rb +0 -12
  51. data/spec/unit/ntriples_datastream_spec.rb +2 -74
  52. data/spec/unit/property_spec.rb +0 -3
  53. data/spec/unit/query_spec.rb +0 -7
  54. data/spec/unit/querying_spec.rb +24 -0
  55. data/spec/unit/rdf/indexing_service_spec.rb +32 -20
  56. data/spec/unit/rdf_resource_datastream_spec.rb +37 -97
  57. data/spec/unit/solr_query_builder_spec.rb +0 -8
  58. data/spec/unit/solr_service_spec.rb +0 -13
  59. metadata +6 -19
  60. data/config/predicate_mappings.yml +0 -51
  61. data/lib/active_fedora/attributes/om_attribute.rb +0 -26
  62. data/lib/active_fedora/attributes/rdf_datastream_attribute.rb +0 -44
  63. data/lib/active_fedora/attributes/stream_attribute.rb +0 -43
  64. data/lib/active_fedora/datastream.rb +0 -9
  65. data/lib/active_fedora/model.rb +0 -31
  66. data/lib/active_fedora/predicates.rb +0 -122
  67. data/lib/active_fedora/simple_datastream.rb +0 -92
  68. data/spec/fixtures/rails_root/config/predicate_mappings.yml +0 -31
  69. data/spec/integration/field_to_solr_name_spec.rb +0 -36
  70. data/spec/unit/base_datastream_management_spec.rb +0 -19
  71. data/spec/unit/model_spec.rb +0 -30
  72. data/spec/unit/predicates_spec.rb +0 -126
  73. data/spec/unit/simple_datastream_spec.rb +0 -101
@@ -151,12 +151,6 @@ module ActiveFedora
151
151
  attributes = { id: attributes_or_id }.with_indifferent_access
152
152
  when Hash
153
153
  attributes = attributes_or_id.with_indifferent_access
154
- # TODO: Remove when we decide using 'pid' is no longer supported.
155
- if !attributes.key?(:id) && attributes.key?(:pid)
156
- Deprecation.warn Core, 'Initializing with :pid is deprecated and will be removed in active-fedora 10.0. Use :id instead'
157
- attributes[:id] = attributes.delete(:pid)
158
- end
159
-
160
154
  when NilClass
161
155
  attributes = {}.with_indifferent_access
162
156
  else
@@ -1,8 +1,6 @@
1
1
  module ActiveFedora
2
2
  module Datastreams
3
3
  extend ActiveSupport::Autoload
4
- # extend Deprecation
5
-
6
4
  autoload :NokogiriDatastreams, 'active_fedora/datastreams/nokogiri_datastreams'
7
5
  end
8
6
  end
@@ -22,10 +22,6 @@ module ActiveFedora #:nodoc:
22
22
  class ConfigurationError < ActiveFedoraError
23
23
  end
24
24
 
25
- # Raised when ActiveFedora cannot find the predicate mapping configuration file
26
- class PredicateMappingsNotFoundError < ConfigurationError
27
- end
28
-
29
25
  # Raised when an object assigned to an association has an incorrect type.
30
26
  #
31
27
  # class Ticket < ActiveFedora::Base
@@ -57,11 +53,6 @@ module ActiveFedora #:nodoc:
57
53
  end
58
54
  end
59
55
 
60
- # Raised when ActiveFedora cannot find the predicate corresponding to the given property
61
- # in the predicate registy
62
- class UnregisteredPredicateError < ActiveFedoraError
63
- end
64
-
65
56
  # Raised by ActiveFedora::Base.save! and ActiveFedora::Base.create! methods when record cannot be
66
57
  # saved because record is invalid.
67
58
  class RecordNotSaved < ActiveFedoraError
@@ -6,7 +6,6 @@ module ActiveFedora
6
6
  extend ActiveModel::Callbacks
7
7
  extend ActiveSupport::Autoload
8
8
  extend ActiveTriples::Properties
9
- extend Deprecation
10
9
  extend Querying
11
10
 
12
11
  autoload :Streaming
@@ -29,32 +28,20 @@ module ActiveFedora
29
28
  define_model_callbacks :update, :save, :create, :destroy
30
29
  define_model_callbacks :initialize, only: :after
31
30
 
32
- # @param parent_or_url_or_hash [ActiveFedora::Base, RDF::URI, String, Hash, NilClass] the parent resource or the URI of this resource
33
- # @param [String] path the path partial relative to the resource
34
- # @param [Hash] _options
31
+ # @param [Hash, RDF::URI, String, NilClass] identifier the id (path) or URI of this resource. The hash gets passed when calling Reflection#build_association, but currently we don't do anything with it.
35
32
  # @yield [self] Yields self
36
33
  # @yieldparam [File] self the newly created file
37
- def initialize(parent_or_url_or_hash = nil, path = nil, _options = {}, &_block)
34
+ def initialize(identifier = nil, &_block)
35
+ identifier = nil if identifier.is_a? Hash
38
36
  run_callbacks(:initialize) do
39
- case parent_or_url_or_hash
40
- when Hash
41
- @ldp_source = build_ldp_resource_via_uri
42
- when nil
43
- @ldp_source = build_ldp_resource_via_uri nil
44
- when String, ::RDF::URI
45
- id = ActiveFedora::Associations::IDComposite.new([parent_or_url_or_hash], translate_uri_to_id).first
37
+ case identifier
38
+ when nil, ::RDF::URI
39
+ @ldp_source = build_ldp_resource_via_uri identifier
40
+ when String
41
+ id = ActiveFedora::Associations::IDComposite.new([identifier], translate_uri_to_id).first
46
42
  @ldp_source = build_ldp_resource id
47
- when ActiveFedora::Base
48
- Deprecation.warn File, "Initializing a file by passing a container is deprecated. Initialize with a uri instead. This capability will be removed in active-fedora 10.0"
49
- uri = if parent_or_url_or_hash.uri.is_a?(::RDF::URI) && parent_or_url_or_hash.uri.value.empty?
50
- nil
51
- else
52
- "#{parent_or_url_or_hash.uri}/#{path}"
53
- end
54
- @ldp_source = build_ldp_resource_via_uri(uri, nil)
55
-
56
43
  else
57
- raise "The first argument to #{self} must be a String or an ActiveFedora::Base. You provided a #{parent_or_url_or_hash.class}"
44
+ raise "The first argument to #{self} must be a Hash, String or RDF::URI. You provided a #{uri.class}"
58
45
  end
59
46
 
60
47
  @attributes = {}.with_indifferent_access
@@ -4,10 +4,7 @@ require 'yaml'
4
4
 
5
5
  module ActiveFedora
6
6
  class FileConfigurator
7
- extend Deprecation
8
7
  # Initializes ActiveFedora's connection to Fedora and Solr based on the info in fedora.yml and solr.yml
9
- # NOTE: this deprecates the use of a solr url in the fedora.yml
10
- #
11
8
  #
12
9
  # If Rails.env is set, it will use that environment. Defaults to "development".
13
10
  # @param [Hash] options (optional) a list of options for the configuration of active_fedora
@@ -49,7 +46,7 @@ module ActiveFedora
49
46
  #
50
47
 
51
48
  attr_accessor :config_env
52
- attr_reader :config_options, :fedora_config_path, :solr_config_path, :predicate_mappings_config_path
49
+ attr_reader :config_options, :fedora_config_path, :solr_config_path
53
50
 
54
51
  # The configuration hash that gets used by RSolr.connect
55
52
  def initialize
@@ -84,7 +81,6 @@ module ActiveFedora
84
81
  @fedora_config = {}
85
82
  @solr_config = {}
86
83
  @config_options = {}
87
- @predicate_config_path = nil
88
84
  end
89
85
 
90
86
  def config_loaded?
@@ -161,11 +157,6 @@ module ActiveFedora
161
157
  end
162
158
  end
163
159
 
164
- def get_config_path(config_type)
165
- Deprecation.warn(FileConfigurator, "get_config_path is deprecated and will be removed in ActiveFedora 10. Use config_path instead.")
166
- config_path(config_type)
167
- end
168
-
169
160
  # Determine the fedora config file to use. Order of preference is:
170
161
  # 1. Use the config_options[:config_path] if it exists
171
162
  # 2. Look in +Rails.root+/config/fedora.yml
@@ -210,27 +201,5 @@ module ActiveFedora
210
201
  return unless ::File.file? path
211
202
  path
212
203
  end
213
-
214
- def predicate_config
215
- @predicate_config_path ||= build_predicate_config_path
216
- YAML.load(::File.open(@predicate_config_path)) if ::File.exist?(@predicate_config_path)
217
- end
218
-
219
- protected
220
-
221
- def build_predicate_config_path
222
- testfile = ::File.expand_path(config_path(:predicate_mappings))
223
- if ::File.exist?(testfile) && valid_predicate_mapping?(testfile)
224
- return testfile
225
- end
226
- raise PredicateMappingsNotFoundError
227
- end
228
-
229
- def valid_predicate_mapping?(testfile)
230
- mapping = YAML.load(::File.open(testfile))
231
- return false unless mapping.key?(:default_namespace) && mapping[:default_namespace].is_a?(String)
232
- return false unless mapping.key?(:predicate_mapping) && mapping[:predicate_mapping].is_a?(Hash)
233
- true
234
- end
235
204
  end
236
205
  end
@@ -45,12 +45,6 @@ module ActiveFedora
45
45
  @ldp_source = build_ldp_resource(id.to_s)
46
46
  end
47
47
 
48
- # TODO: Remove after we no longer support #pid.
49
- def pid
50
- Deprecation.warn FedoraAttributes, "#{self.class}#pid is deprecated and will be removed in active-fedora 10.0. Use #{self.class}#id instead."
51
- id
52
- end
53
-
54
48
  # @return [RDF::URI] the uri for this resource
55
49
  def uri
56
50
  @ldp_source.subject_uri
@@ -12,18 +12,6 @@ module ActiveFedora
12
12
  self.class.graph_class
13
13
  end
14
14
 
15
- ##
16
- # @param [RDF::Graph] original_graph The graph returned by the LDP server
17
- # @return [RDF::Graph] A graph striped of any inlined resources present in the original
18
- def build_graph(original_graph)
19
- Deprecation.warn(ActiveFedora::LdpResource, '#build_graph is deprecated and will be removed in active-fedora 10.0')
20
- inlined_resources = get.graph.query(predicate: Ldp.contains).map(&:object)
21
-
22
- # ActiveFedora always wants to copy the resources to a new graph because it
23
- # forces a cast to FedoraRdfResource
24
- graph_without_inlined_resources(original_graph, inlined_resources)
25
- end
26
-
27
15
  # Don't dump @client, it has a proc and thus can't be serialized.
28
16
  def marshal_dump
29
17
  (instance_variables - [:@client]).map { |name| [name, instance_variable_get(name)] }
@@ -81,7 +81,7 @@ module ActiveFedora
81
81
 
82
82
  # Constructor. this class will call self.field for each DCTERM. In short, all DCTERMS fields will already exist
83
83
  # when this method returns. Each term is marked as a multivalue string.
84
- def initialize(digital_object = nil, dsid = nil, options = {})
84
+ def initialize(string_or_url = nil)
85
85
  super
86
86
  self.fields = {}
87
87
  DCTERMS.each do |el|
@@ -12,23 +12,6 @@ module ActiveFedora
12
12
  lazy_reify_solr_results(solr_results, opts).to_a
13
13
  end
14
14
 
15
- def self.reify_solr_result(hit, _opts = {})
16
- Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.reify_solr_result is deprecated and will be removed in ActiveFedora 10.0; call #reify on the SolrHit instead.')
17
- ActiveFedora::SolrHit.for(hit).reify
18
- end
19
-
20
- # Returns all possible classes for the solr object
21
- def self.classes_from_solr_document(hit, _opts = {})
22
- Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.classes_from_solr_document is deprecated and will be removed in ActiveFedora 10.0; call #models on the SolrHit instead.')
23
- ActiveFedora::SolrHit.for(hit).models
24
- end
25
-
26
- # Returns the best singular class for the solr object
27
- def self.class_from_solr_document(hit, opts = {})
28
- Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.class_from_solr_document is deprecated and will be removed in ActiveFedora 10.0; call #model on the SolrHit instead.')
29
- ActiveFedora::SolrHit.for(hit).model(opts)
30
- end
31
-
32
15
  HAS_MODEL_SOLR_FIELD = ActiveFedora.index_field_mapper.solr_name("has_model", :symbol).freeze
33
16
  end
34
17
  end
@@ -8,17 +8,6 @@ module ActiveFedora::RDF
8
8
  end
9
9
  end
10
10
 
11
- # Gives the primary solr name for a column. If there is more than one indexer on the field definition, it gives the first
12
- def primary_solr_name(field, file_path)
13
- config = self.class.config_for_term_or_uri(field)
14
- return nil unless config && config.behaviors # punt on index names for deep nodes!
15
- config.behaviors.each do |behavior|
16
- result = ActiveFedora.index_field_mapper.solr_name(apply_prefix(field, file_path), behavior, type: config.type)
17
- return result if Solrizer::DefaultDescriptors.send(behavior).evaluate_suffix(:text).stored?
18
- end
19
- raise RuntimeError "no stored fields were found"
20
- end
21
-
22
11
  module ClassMethods
23
12
  def indexer
24
13
  ActiveFedora::RDF::IndexingService
@@ -8,7 +8,7 @@ module ActiveFedora::RDF
8
8
  include Solrizer::Common
9
9
  attr_reader :object
10
10
 
11
- # @param obj [#resource, #rdf_subject] the object to build an solr document for. Its class must respond to 'properties'
11
+ # @param [#resource, #rdf_subject] obj the object to build an solr document for. Its class must respond to 'properties' and 'index_config'
12
12
  def initialize(obj)
13
13
  @object = obj
14
14
  end
@@ -14,16 +14,6 @@ module ActiveFedora
14
14
  @subject_block ||= ->(ds) { parent_uri(ds) }
15
15
  end
16
16
 
17
- def property(name, *args, &block)
18
- super
19
- add_attribute_indexing_config(name, &block) if block_given?
20
- end
21
-
22
- def add_attribute_indexing_config(name, &block)
23
- Deprecation.warn(RDFDatastream, "Adding indexing to datastreams is deprecated")
24
- index_config[name] ||= ActiveFedora::Indexing::Map::IndexObject.new(name, &block)
25
- end
26
-
27
17
  # Trim the last segment off the URI to get the parents uri
28
18
  def parent_uri(ds)
29
19
  m = /^(.*)\/[^\/]*$/.match(ds.uri)
@@ -48,15 +48,8 @@ module ActiveFedora
48
48
  options[:order] ||= sort if sort.present?
49
49
  end
50
50
 
51
- if options.present?
52
- options = args.first unless args.empty?
53
- Deprecation.warn(ActiveFedora::Base, "Calling .find with a hash has been deprecated and will not be allowed in active-fedora 10.0. Use .where instead")
54
- options = { conditions: options }
55
- apply_finder_options(options)
56
- else
57
- raise ArgumentError, "#{self}.find() expects an id. You provided `#{args.inspect}'" unless args.is_a? Array
58
- find_with_ids(args, cast)
59
- end
51
+ raise ArgumentError, "#{self}.find() expects an id. You provided `#{args.inspect}'" unless args.is_a? Array
52
+ find_with_ids(args, cast)
60
53
  end
61
54
 
62
55
  # Gives a record (or N records if a parameter is supplied) without any implied
@@ -125,12 +118,6 @@ module ActiveFedora
125
118
  result.first
126
119
  end
127
120
 
128
- # @deprecated
129
- def find_with_conditions(*args)
130
- Deprecation.warn(ActiveFedora::Base, '.find_with_conditions is deprecated and will be removed in active-fedora 10.0; use .search_with_conditions instead')
131
- search_with_conditions(*args)
132
- end
133
-
134
121
  # Yields the found ActiveFedora::Base object to the passed block
135
122
  #
136
123
  # @param [Hash] conditions the conditions for the solr search to match
@@ -182,12 +169,6 @@ module ActiveFedora
182
169
  end
183
170
  end
184
171
 
185
- # @deprecated
186
- def find_in_batches(*args, &block)
187
- Deprecation.warn(ActiveFedora::Base, '.find_in_batches is deprecated and will be removed in active-fedora 10.0; use .search_in_batches instead')
188
- search_in_batches(*args, &block)
189
- end
190
-
191
172
  # Retrieve the Fedora object with the given id, explore the returned object
192
173
  # Raises a ObjectNotFoundError if the object is not found.
193
174
  # @param [String] id of the object to load
@@ -1,7 +1,5 @@
1
1
  module ActiveFedora
2
2
  module SolrQueryBuilder
3
- extend Deprecation
4
-
5
3
  class << self
6
4
  # Construct a solr query for a list of ids
7
5
  # This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
@@ -13,20 +11,6 @@ module ActiveFedora
13
11
  "{!terms f=#{ActiveFedora.id_field}}#{ids.join(',')}"
14
12
  end
15
13
 
16
- # Create a raw query clause suitable for sending to solr as an fq element
17
- # @param [String] key
18
- # @param [String] value
19
- def raw_query(key, value)
20
- Deprecation.warn(ActiveFedora::SolrQueryBuilder, 'ActiveFedora::SolrQueryBuilder.raw_query is deprecated and will be removed in ActiveFedora 10.0. Use .construct_query instead.')
21
- "_query_:\"{!raw f=#{key}}#{value.gsub('"', '\"')}\""
22
- end
23
-
24
- # @deprecated
25
- def solr_name(*args)
26
- Deprecation.warn(ActiveFedora::SolrQueryBuilder, 'ActiveFedora::SolrQueryBuilder.solr_name is deprecated and will be removed in ActiveFedora 10.0. Use ActiveFedora.index_field_mapper.solr_name instead.')
27
- ActiveFedora.index_field_mapper.solr_name(*args)
28
- end
29
-
30
14
  # Create a query with a clause for each key, value
31
15
  # @param [Hash, Array<Array<String>>] field_pairs key is the predicate, value is the target_uri
32
16
  # @param [String] join_with ('AND') the value we're joining the clauses with
@@ -1,10 +1,7 @@
1
1
  require 'rsolr'
2
- require 'deprecation'
3
2
 
4
3
  module ActiveFedora
5
4
  class SolrService
6
- extend Deprecation
7
-
8
5
  attr_writer :conn
9
6
 
10
7
  def initialize(options = {})
@@ -16,18 +13,8 @@ module ActiveFedora
16
13
  end
17
14
 
18
15
  class << self
19
- def register(*args)
20
- options = args.extract_options!
21
-
22
- if args.length == 1
23
- Deprecation.warn(SolrService, "SolrService.register with a host argument is deprecated. Use `SolrService.register(url: host)` instead. This will be removed in active-fedora 10.0")
24
-
25
- host = args.first
26
- options[:url] = host if host
27
- elsif args.length > 1
28
- raise ArgumentError, "wrong number of arguments (#{args.length} for 0..2)"
29
- end
30
-
16
+ # @param [Hash] options
17
+ def register(options = {})
31
18
  ActiveFedora::RuntimeRegistry.solr_service = new(options)
32
19
  end
33
20
 
@@ -49,87 +36,13 @@ module ActiveFedora
49
36
  ActiveFedora::RuntimeRegistry.solr_service
50
37
  end
51
38
 
52
- def lazy_reify_solr_results(solr_results, opts = {})
53
- Deprecation.warn SolrService, "SolrService.lazy_reify_solr_results is deprecated. Use QueryResultBuilder.lazy_reify_solr_results instead. This will be removed in active-fedora 10.0"
54
- QueryResultBuilder.lazy_reify_solr_results(solr_results, opts)
55
- end
56
-
57
- def reify_solr_results(solr_results, opts = {})
58
- Deprecation.warn SolrService, "SolrService.reify_solr_results is deprecated. Use QueryResultBuilder.reify_solr_results instead. This will be removed in active-fedora 10.0"
59
- QueryResultBuilder.reify_solr_results(solr_results, opts)
60
- end
61
-
62
- def reify_solr_result(hit, opts = {})
63
- Deprecation.warn SolrService, "SolrService.reify_solr_result is deprecated. Use SolrHit#reify instead. This will be removed in active-fedora 10.0"
64
- QueryResultBuilder.reify_solr_result(hit, opts)
65
- end
66
-
67
- # Returns all possible classes for the solr object
68
- def classes_from_solr_document(hit, opts = {})
69
- Deprecation.warn SolrService, "SolrService.classes_from_solr_document is deprecated. Use SolrHit#models instead. This will be removed in active-fedora 10.0"
70
- QueryResultBuilder.classes_from_solr_document(hit, opts)
71
- end
72
-
73
- # Returns the best singular class for the solr object
74
- def class_from_solr_document(hit, opts = {})
75
- Deprecation.warn SolrService, "SolrService.class_from_solr_document is deprecated. Use SolrHit#model instead. This will be removed in active-fedora 10.0"
76
- QueryResultBuilder.class_from_solr_document(hit, opts)
77
- end
78
-
79
- # Construct a solr query for a list of ids
80
- # This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
81
- # If the id_array is empty, defaults to a query of "id:NEVER_USE_THIS_ID", which will return an empty solr response
82
- # @param [Array] id_array the ids that you want included in the query
83
- def construct_query_for_ids(id_array)
84
- Deprecation.warn SolrService, "SolrService.construct_query_for_ids is deprecated. Use SolrQueryBuilder.construct_query_for_ids instead. This will be removed in active-fedora 10.0"
85
- SolrQueryBuilder.construct_query_for_ids(id_array)
86
- end
87
-
88
- def construct_query_for_pids(id_array)
89
- Deprecation.warn SolrService, "SolrService.construct_query_for_pids is deprecated. Use SolrQueryBuilder.construct_query_for_ids instead. This will be removed in active-fedora 10.0"
90
- SolrQueryBuilder.construct_query_for_ids(id_array)
91
- end
92
-
93
- # Create a raw query clause suitable for sending to solr as an fq element
94
- # @param [String] key
95
- # @param [String] value
96
- def raw_query(key, value)
97
- Deprecation.warn SolrService, "SolrService.raw_query is deprecated. Use SolrQueryBuilder.construct_query instead. This will be removed in active-fedora 10.0"
98
- SolrQueryBuilder.construct_query(key, value)
99
- end
100
-
101
- def solr_name(*args)
102
- Deprecation.warn SolrService, "SolrService.solr_name is deprecated. Use SolrQueryBuilder.solr_name instead. This will be removed in active-fedora 10.0"
103
- SolrQueryBuilder.solr_name(*args)
104
- end
105
-
106
- # Create a query with a clause for each key, value
107
- # @param [Hash, Array<Array<String>>] field_pairs key is the predicate, value is the target_uri
108
- # @param [String] join_with ('AND') the value we're joining the clauses with
109
- # @example
110
- # construct_query_for_rel [[:has_model, "info:fedora/afmodel:ComplexCollection"], [:has_model, "info:fedora/afmodel:ActiveFedora_Base"]], 'OR'
111
- # # => _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ComplexCollection" OR _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ActiveFedora_Base"
112
- #
113
- # construct_query_for_rel [[Book._reflect_on_association(:library), "foo/bar/baz"]]
114
- def construct_query_for_rel(field_pairs, join_with = 'AND')
115
- Deprecation.warn SolrService, "SolrService.construct_query_for_rel is deprecated. Use SolrQueryBuilder.construct_query_for_rel instead. This will be removed in active-fedora 10.0"
116
- SolrQueryBuilder.construct_query_for_rel(field_pairs, join_with)
117
- end
118
-
119
39
  def get(query, args = {})
120
40
  args = args.merge(q: query, qt: 'standard')
121
41
  SolrService.instance.conn.get(select_path, params: args)
122
42
  end
123
43
 
124
44
  def query(query, args = {})
125
- raw = args.delete(:raw)
126
45
  result = get(query, args)
127
-
128
- if raw
129
- Deprecation.warn SolrService, "SolrService.query with raw: true is deprecated. Use SolrService.get instead. This will be removed in active-fedora 10.0"
130
- return result
131
- end
132
-
133
46
  result['response']['docs'].map do |doc|
134
47
  ActiveFedora::SolrHit.new(doc)
135
48
  end