solrizer-fedora 1.2.5 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -4,6 +4,7 @@
4
4
  # development environment upon cd'ing into the directory
5
5
 
6
6
  ruby_string="ree-1.8.7"
7
+ rubygems_version="1.8.17"
7
8
  gemset_name="solrizer-fedora"
8
9
 
9
10
  #
@@ -25,11 +26,14 @@ else
25
26
  rvm --create "$environment_id"
26
27
  fi
27
28
 
28
- #(
29
- # Ensure that Bundler is installed, install it if it is not.
30
- if ! command -v bundle ; then
31
- printf "The rubygem 'bundler' is not installed, installing it now.\n"
32
- gem install bundler
33
- fi
34
- #)&
29
+ # Use the specified rubygems_version
30
+ if [[ -n "${rubygems_version}" && ("$(gem --version)" != ${rubygems_version}) ]] ; then
31
+ rvm rubygems "${rubygems_version}"
32
+ fi
33
+
34
+ # Ensure that Bundler is installed, install it if it is not.
35
+ if ! command -v bundle ; then
36
+ printf "The rubygem 'bundler' is not installed, installing it now.\n"
37
+ gem install bundler
38
+ fi
35
39
 
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "http://rubygems.org"
3
3
  group :development, :test do
4
4
  gem 'jeweler'
5
5
  gem 'jettywrapper'
6
- gem 'rspec', '>=2.8.0'
6
+ gem 'rspec', '~>2.6.0'#'>=2.8.0'
7
7
  gem 'mocha'
8
8
  gem 'yard'
9
9
  gem 'RedCloth'
data/Gemfile.lock CHANGED
@@ -1,33 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- solrizer-fedora (1.2.3)
5
- active-fedora (~> 3.2.0)
6
- activesupport (= 3.0.11)
4
+ solrizer-fedora (2.0.0.rc1)
5
+ active-fedora (= 4.0.0.rc15)
7
6
  fastercsv
8
- rsolr (= 1.0.6)
9
- solr-ruby (>= 0.0.6)
10
- solrizer (>= 1.0.0)
11
7
 
12
8
  GEM
13
9
  remote: http://rubygems.org/
14
10
  specs:
15
11
  RedCloth (4.2.9)
16
- active-fedora (3.2.2)
12
+ active-fedora (4.0.0.rc15)
17
13
  activeresource (>= 3.0.0)
18
14
  activesupport (>= 3.0.0)
19
15
  equivalent-xml
20
- facets
21
16
  mediashelf-loggable
22
17
  mime-types (>= 1.16)
23
18
  multipart-post (= 1.1.2)
24
19
  nokogiri
25
- om (>= 1.4.4)
20
+ om (>= 1.5.3)
26
21
  rdf
27
- rdf-rdfxml
28
- rubydora (~> 0.4.1)
29
- solr-ruby (>= 0.0.6)
30
- solrizer (> 1.0.0)
22
+ rdf-rdfxml (= 0.3.5)
23
+ rsolr
24
+ rubydora (~> 0.5.7)
25
+ solrizer (~> 1.2.0)
31
26
  xml-simple (>= 1.0.12)
32
27
  activemodel (3.0.11)
33
28
  activesupport (= 3.0.11)
@@ -37,23 +32,22 @@ GEM
37
32
  activemodel (= 3.0.11)
38
33
  activesupport (= 3.0.11)
39
34
  activesupport (3.0.11)
40
- addressable (2.2.6)
35
+ addressable (2.2.7)
41
36
  akami (1.0.0)
42
37
  gyoku (>= 0.4.0)
43
38
  builder (2.1.2)
44
39
  childprocess (0.2.3)
45
40
  ffi (~> 1.0.6)
46
- daemons (1.1.6)
41
+ daemons (1.1.8)
47
42
  diff-lcs (1.1.3)
48
43
  equivalent-xml (0.2.9)
49
44
  nokogiri (>= 1.4.3)
50
- facets (2.9.3)
51
45
  fastercsv (1.5.4)
52
46
  ffi (1.0.11)
53
47
  git (1.2.5)
54
48
  gyoku (0.4.4)
55
49
  builder (>= 2.1.2)
56
- httpi (0.9.5)
50
+ httpi (0.9.6)
57
51
  rack
58
52
  i18n (0.5.0)
59
53
  jettywrapper (1.2.0)
@@ -74,14 +68,14 @@ GEM
74
68
  mocha (0.10.0)
75
69
  metaclass (~> 0.0.1)
76
70
  multipart-post (1.1.2)
77
- nokogiri (1.5.0)
78
- nori (1.0.2)
79
- om (1.5.0)
71
+ nokogiri (1.5.2)
72
+ nori (1.1.0)
73
+ om (1.5.3)
80
74
  mediashelf-loggable
81
75
  nokogiri (>= 1.4.2)
82
76
  rack (1.4.1)
83
77
  rake (0.9.2.2)
84
- rdf (0.3.4.1)
78
+ rdf (0.3.5.1)
85
79
  addressable (>= 2.2.6)
86
80
  rdf-rdfxml (0.3.5)
87
81
  nokogiri (>= 1.4.4)
@@ -90,17 +84,17 @@ GEM
90
84
  json (~> 1.4)
91
85
  rest-client (1.6.7)
92
86
  mime-types (>= 1.16)
93
- rsolr (1.0.6)
87
+ rsolr (1.0.7)
94
88
  builder (>= 2.1.2)
95
- rspec (2.8.0)
96
- rspec-core (~> 2.8.0)
97
- rspec-expectations (~> 2.8.0)
98
- rspec-mocks (~> 2.8.0)
99
- rspec-core (2.8.0)
100
- rspec-expectations (2.8.0)
89
+ rspec (2.6.0)
90
+ rspec-core (~> 2.6.0)
91
+ rspec-expectations (~> 2.6.0)
92
+ rspec-mocks (~> 2.6.0)
93
+ rspec-core (2.6.4)
94
+ rspec-expectations (2.6.0)
101
95
  diff-lcs (~> 1.1.2)
102
- rspec-mocks (2.8.0)
103
- rubydora (0.4.1)
96
+ rspec-mocks (2.6.0)
97
+ rubydora (0.5.7)
104
98
  activemodel
105
99
  activesupport
106
100
  fastercsv
@@ -108,24 +102,23 @@ GEM
108
102
  nokogiri
109
103
  rest-client
110
104
  savon
111
- savon (0.9.7)
105
+ savon (0.9.9)
112
106
  akami (~> 1.0)
113
107
  builder (>= 2.1.2)
114
108
  gyoku (>= 0.4.0)
115
109
  httpi (~> 0.9)
116
110
  nokogiri (>= 1.4.0)
117
- nori (~> 1.0)
118
- wasabi (~> 2.0)
119
- solr-ruby (0.0.8)
120
- solrizer (1.1.2)
111
+ nori (~> 1.1)
112
+ wasabi (~> 2.1)
113
+ solrizer (1.2.0)
121
114
  daemons
122
- mediashelf-loggable
115
+ mediashelf-loggable (~> 0.4.7)
123
116
  nokogiri
124
- om (>= 1.4.0)
117
+ om (>= 1.5.0)
125
118
  stomp
126
119
  xml-simple
127
- stomp (1.2.0)
128
- wasabi (2.0.0)
120
+ stomp (1.2.1)
121
+ wasabi (2.1.0)
129
122
  nokogiri (>= 1.4.0)
130
123
  xml-simple (1.1.1)
131
124
  yard (0.7.4)
@@ -139,6 +132,6 @@ DEPENDENCIES
139
132
  jeweler
140
133
  mocha
141
134
  rdoc
142
- rspec (>= 2.8.0)
135
+ rspec (~> 2.6.0)
143
136
  solrizer-fedora!
144
137
  yard
data/History.textile CHANGED
@@ -1,3 +1,8 @@
1
+ h2. 2.0.0
2
+ Requiring active-fedora >= 3.3.3
3
+ Supports sharding.
4
+ Removed dependency on ruby-solr
5
+
1
6
  h2. 1.2.5
2
7
  Requiring active-fedora >= 3.2.0
3
8
 
data/Rakefile CHANGED
@@ -1,20 +1,22 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ # require 'rubygems'
2
+ # require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
3
7
 
4
8
  # load rake tasks in lib/tasks
5
9
  Dir.glob('lib/tasks/*.rake').each { |r| import r }
6
10
 
7
- require 'bundler'
8
- Bundler::GemHelper.install_tasks
9
11
 
10
- require 'spec/rake/spectask'
11
- Spec::Rake::SpecTask.new(:spec) do |spec|
12
- spec.libs << 'lib' << 'spec'
13
- spec.spec_files = FileList['spec/**/*_spec.rb']
12
+ RSpec::Core::RakeTask.new(:spec) do |spec|
13
+ # spec.libs << 'lib' << 'spec'
14
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
15
+ spec.pattern = 'spec/**/*_spec.rb'
14
16
  end
15
17
 
16
- Spec::Rake::SpecTask.new(:rcov) do |spec|
17
- spec.libs << 'lib' << 'spec'
18
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
19
+ # spec.libs << 'lib' << 'spec'
18
20
  spec.pattern = 'spec/**/*_spec.rb'
19
21
  spec.rcov = true
20
22
  end
data/config/fedora.yml CHANGED
@@ -1,16 +1,13 @@
1
1
  development:
2
- fedora:
3
- url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora
4
- solr:
5
- url: http://127.0.0.1:8983/solr/development
2
+ user: fedoraAdmin
3
+ password: fedoraAdmin
4
+ url: http://127.0.0.1:8983/fedora
6
5
  test:
7
- fedora:
8
- url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora
9
- solr:
10
- url: http://127.0.0.1:8983/solr/test
6
+ user: fedoraAdmin
7
+ password: fedoraAdmin
8
+ url: http://127.0.0.1:8983/fedora
11
9
  production:
12
- fedora:
13
- url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8080/fedora
14
- solr:
15
- url: http://127.0.0.1:8080/solr
10
+ user: fedoraAdmin
11
+ password: fedoraAdmin
12
+ url: http://127.0.0.1:8080/fedora
16
13
 
@@ -49,11 +49,6 @@ class Indexer
49
49
  #
50
50
 
51
51
  def connect
52
-
53
- # if ActiveFedora.fedora_config.empty?
54
- # ActiveFedora.init
55
- # end
56
-
57
52
  if defined?(Blacklight)
58
53
  solr_config = Blacklight.solr_config
59
54
  else
@@ -95,30 +90,13 @@ class Indexer
95
90
  end
96
91
 
97
92
  @solr = RSolr.connect :url => url
98
- # @connection = Solr::Connection.new(url, :autocommit => :on )
99
93
 
100
94
  rescue RuntimeError => e
101
95
  logger.debug "Unable to establish SOLR Connection with #{solr_config.inspect}. Failed with #{e.message}"
102
96
  raise URI::InvalidURIError
103
97
  end
104
98
 
105
- #
106
- # This method extracts the facet categories from the given Fedora object's external tag datastream
107
- #
108
- def extract_xml_to_solr( obj, ds_name, solr_doc=Hash.new )
109
- xml_ds = Repository.get_datastream( obj, ds_name )
110
- extractor.xml_to_solr( xml_ds.content, solr_doc )
111
- end
112
-
113
- #
114
- #
115
- #
116
- def extract_rels_ext( obj, ds_name, solr_doc=Hash.new )
117
- rels_ext_ds = Repository.get_datastream( obj, ds_name )
118
- extractor.extract_rels_ext( rels_ext_ds.content, solr_doc )
119
- end
120
-
121
- #
99
+ #
122
100
  # This method generates the month and day facets from the date_t in solr_doc
123
101
  #
124
102
 
@@ -158,8 +136,7 @@ class Indexer
158
136
 
159
137
  return solr_doc
160
138
 
161
- end
162
-
139
+ end
163
140
 
164
141
  #
165
142
  # This method creates a Solr-formatted XML document
@@ -224,23 +201,9 @@ class Indexer
224
201
  end
225
202
 
226
203
  end
227
-
228
- #
229
- # This method queries the Solr search index and returns a response
230
- #
231
- def query( query_str )
232
- response = conn.query( query_str )
233
- end
234
204
 
235
205
 
236
206
  private :connect, :create_document
237
207
 
238
- def class_exists?(class_name)
239
- klass = Module.const_get(class_name)
240
- return klass.is_a?(Class)
241
- rescue NameError
242
- return false
243
- end
244
-
245
208
  end
246
209
  end
@@ -6,137 +6,148 @@ require 'solrizer/xml'
6
6
  require 'solrizer/html'
7
7
 
8
8
  require 'active_support/core_ext/hash'
9
- # Let people explicitly require xml support if they want it ...
10
- # require 'solrizer/xml.rb'
11
9
 
12
10
  require 'fastercsv' # this is used by solrize_objects when you pass it a csv file of pids
13
11
 
14
12
 
15
13
  module Solrizer::Fedora
16
- class Solrizer
17
- ALL_FIELDS = [
18
- :pid, :label, :fType, :cModel, :state, :ownerId, :cDate, :mDate, :dcmDate,
19
- :bMech, :title, :creator, :subject, :description, :contributor,
20
- :date, :type, :format, :identifier, :source, :language, :relation, :coverage, :rights
21
- ]
22
-
23
- attr_accessor :indexer, :index_full_text
24
-
25
- #
26
- # This method initializes the indexer
27
- # If passed an argument of :index_full_text=>true, it will perform full-text indexing instead of indexing fields only.
28
- #
29
- def initialize( opts={} )
30
- @@index_list = false unless defined?(@@index_list)
31
- if opts[:index_full_text] == true || opts[:index_full_text] == "true"
32
- @index_full_text = true
33
- else
34
- @index_full_text = false
14
+ class Solrizer
15
+ ALL_FIELDS = [
16
+ :pid, :label, :fType, :cModel, :state, :ownerId, :cDate, :mDate, :dcmDate,
17
+ :bMech, :title, :creator, :subject, :description, :contributor,
18
+ :date, :type, :format, :identifier, :source, :language, :relation, :coverage, :rights
19
+ ]
20
+
21
+ attr_accessor :indexer, :index_full_text
22
+
23
+ #
24
+ # This method initializes the indexer
25
+ # If passed an argument of :index_full_text=>true, it will perform full-text indexing instead of indexing fields only.
26
+ #
27
+ def initialize( opts={} )
28
+ @@index_list = false unless defined?(@@index_list)
29
+ if opts[:index_full_text] == true || opts[:index_full_text] == "true"
30
+ @index_full_text = true
31
+ else
32
+ @index_full_text = false
33
+ end
34
+ @indexer = Indexer.new( :index_full_text=>@index_full_text )
35
35
  end
36
- @indexer = Indexer.new( :index_full_text=>@index_full_text )
37
- end
38
-
39
- # Solrize the given Fedora object's full-text and facets into the search index
40
- #
41
- # @param [String or ActiveFedora::Base] obj the object to solrize
42
- # @param [Hash] opts optional parameters
43
- # @example Suppress errors using :suppress_errors option
44
- # solrizer.solrize("my:pid", :suppress_errors=>true)
45
- def solrize( obj, opts={} )
46
- # retrieve the Fedora object based on the given unique id
47
-
36
+
37
+ # Solrize the given Fedora object's full-text and facets into the search index
38
+ #
39
+ # @param [String or ActiveFedora::Base] obj the object to solrize
40
+ # @param [Hash] opts optional parameters
41
+ # @example Suppress errors using :suppress_errors option
42
+ # solrizer.solrize("my:pid", :suppress_errors=>true)
43
+ def solrize( obj, opts={} )
44
+ # retrieve the Fedora object based on the given unique id
45
+
48
46
  begin
49
-
50
- start = Time.now
51
- logger.debug "SOLRIZER Retrieving object #{obj} ..."
47
+
48
+ start = Time.now
49
+ logger.debug "SOLRIZER Retrieving object #{obj} ..."
52
50
 
53
51
 
54
- if obj.kind_of? ActiveFedora::Base
55
- # do nothing
56
- elsif obj.kind_of? String
57
- obj = Repository.get_object( obj )
58
- elsif obj.respond_to? :pid
59
- obj = Repository.get_object( obj.pid )
60
- else
61
- raise "you must pass either a ActiveFedora::Base, Fedora::RepositoryObject, or a String. You submitted a #{obj.class}"
62
- end
63
-
64
- obj_done = Time.now
65
- obj_done_elapse = obj_done - start
66
- logger.debug " completed. Duration: #{obj_done_elapse}"
52
+ if obj.kind_of? ActiveFedora::Base
53
+ # do nothing
54
+ elsif obj.kind_of? String
55
+ obj = Repository.get_object( obj )
56
+ elsif obj.respond_to? :pid
57
+ obj = Repository.get_object( obj.pid )
58
+ else
59
+ raise "you must pass either a ActiveFedora::Base, Fedora::RepositoryObject, or a String. You submitted a #{obj.class}"
60
+ end
61
+
62
+ obj_done = Time.now
63
+ obj_done_elapse = obj_done - start
64
+ logger.debug " completed. Duration: #{obj_done_elapse}"
65
+
66
+ logger.debug "\t Indexing object #{obj.pid} ... "
67
+ # add the keywords and facets to the search index
68
+ index_start = Time.now
69
+ indexer.index( obj )
70
+
71
+ index_done = Time.now
72
+ index_elapsed = index_done - index_start
73
+
74
+ logger.debug "completed. Duration: #{index_elapsed} ."
67
75
 
68
- logger.debug "\t Indexing object #{obj.pid} ... "
69
- # add the keywords and facets to the search index
70
- index_start = Time.now
71
- indexer.index( obj )
72
-
73
- index_done = Time.now
74
- index_elapsed = index_done - index_start
75
-
76
- logger.debug "completed. Duration: #{index_elapsed} ."
77
76
 
78
-
79
77
  rescue Exception => e
80
- if opts[:suppress_errors]
81
- logger.debug "SOLRIZER unable to index #{obj}. Failed with #{e.inspect}"
82
- else
83
- raise e
84
- end
85
- end #begin
86
-
87
- end
88
-
89
- # Retrieve a comprehensive list of all the unique identifiers in Fedora and
90
- # solrize each object's full-text and facets into the search index
91
- #
92
- # @example Suppress errors using :suppress_errors option
93
- # solrizer.solrize_objects( :suppress_errors=>true )
94
- def solrize_objects(opts={})
95
- # retrieve a list of all the pids in the fedora repository
96
- num_docs = 1000000 # modify this number to guarantee that all the objects are retrieved from the repository
97
- puts "WARNING: You have turned off indexing of Full Text content. Be sure to re-run indexer with @@index_full_text set to true in main.rb" if index_full_text == false
98
-
99
- if @@index_list == false
100
-
101
- objects = find_objects(:limit=>num_docs)
102
-
103
- puts "Shelving #{objects.length} Fedora objects"
104
- objects.each do |object|
105
- solrize( object, opts )
78
+ if opts[:suppress_errors]
79
+ logger.debug "SOLRIZER unable to index #{obj}. Failed with #{e.inspect}"
80
+ else
81
+ raise e
82
+ end
106
83
  end
107
-
108
- else
84
+
85
+ end
109
86
 
110
- if File.exists?(@@index_list)
111
- arr_of_pids = FasterCSV.read(@@index_list, :headers=>false)
112
-
113
- puts "Indexing from list at #{@@index_list}"
114
- puts "Shelving #{arr_of_pids.length} Fedora objects"
115
-
116
- arr_of_pids.each do |row|
117
- pid = row[0]
118
- solrize( pid )
119
- end #FASTERCSV
120
- else
121
- puts "#{@@index_list} does not exists!"
122
- end #if File.exists
123
-
124
- end #if Index_LISTS
125
- end #solrize_objects
126
-
127
- def find_objects(*args)
128
- raise ArgumentError, "Missing query string" unless args.length >= 1
129
- options = args.last.is_a?(Hash) ? args.pop : {}
130
-
131
- params = {}
132
- params[:query] = ''
133
- params[:maxResults] = options[:limit] if options[:limit]
134
- params[:pid] = true
135
- connection = ActiveFedora::RubydoraConnection.instance.connection
136
- response = Hash.from_xml(connection.find_objects(params))
137
- response["result"]["resultList"]["objectFields"].map{|x| x["pid"]}
138
- end
87
+ # Retrieve a comprehensive list of all the unique identifiers in Fedora and
88
+ # solrize each object's full-text and facets into the search index
89
+ #
90
+ # @example Suppress errors using :suppress_errors option
91
+ # solrizer.solrize_objects( :suppress_errors=>true )
92
+ def solrize_objects(opts={})
93
+ # retrieve a list of all the pids in the fedora repository
94
+ num_docs = 1000000 # modify this number to guarantee that all the objects are retrieved from the repository
95
+ puts "WARNING: You have turned off indexing of Full Text content. Be sure to re-run indexer with @@index_full_text set to true in main.rb" if index_full_text == false
96
+
97
+ if @@index_list == false
98
+
99
+ objects = find_objects(:limit=>num_docs)
100
+
101
+ puts "Shelving #{objects.length} Fedora objects"
102
+ objects.each do |object|
103
+ solrize( object, opts )
104
+ end
105
+
106
+ else
107
+ if File.exists?(@@index_list)
108
+ arr_of_pids = FasterCSV.read(@@index_list, :headers=>false)
109
+
110
+ puts "Indexing from list at #{@@index_list}"
111
+ puts "Shelving #{arr_of_pids.length} Fedora objects"
112
+
113
+ arr_of_pids.each do |row|
114
+ pid = row[0]
115
+ solrize( pid )
116
+ end #FASTERCSV
117
+ else
118
+ puts "#{@@index_list} does not exists!"
119
+ end #if File.exists
120
+
121
+ end #if Index_LISTS
122
+ end #solrize_objects
123
+
124
+ def find_objects(*args)
125
+ raise ArgumentError, "Missing query string" unless args.length >= 1
126
+ options = args.last.is_a?(Hash) ? args.pop : {}
127
+
128
+ params = {}
129
+ params[:query] = ''
130
+ params[:maxResults] = options[:limit] if options[:limit]
131
+ params[:pid] = true
132
+
133
+ pids = []
134
+ connections.each do |conn|
135
+ response = Hash.from_xml(conn.find_objects(params))
136
+ pids << response["result"]["resultList"]["objectFields"].map{|x| x["pid"]}
137
+ end
138
+ pids.flatten
139
+ end
140
+
141
+ private
139
142
 
143
+ def connections
144
+ if ActiveFedora.config.sharded?
145
+ return ActiveFedora.config.credentials.map { |cred| ActiveFedora::RubydoraConnection.new(cred).connection}
146
+ else
147
+ return [ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials).connection]
148
+ end
149
+ end
150
+
140
151
 
141
- end #class
152
+ end #class
142
153
  end #module
@@ -1,5 +1,5 @@
1
1
  module Solrizer
2
2
  module Fedora
3
- VERSION = "1.2.5"
3
+ VERSION = "2.0.0.rc1"
4
4
  end
5
5
  end
@@ -74,8 +74,9 @@ namespace :solrizer do
74
74
  puts "Solrizer task complete."
75
75
  end
76
76
 
77
- Spec::Rake::SpecTask.new(:rspec) do |t|
78
- t.spec_files = FileList['spec/**/*_spec.rb']
77
+ RSpec::Core::RakeTask.new(:rspec) do |t|
78
+ t.pattern = 'spec/**/*_spec.rb'
79
+ #t.spec_files = FileList['spec/**/*_spec.rb']
79
80
  t.rcov = true
80
81
  t.rcov_opts = lambda do
81
82
  IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
@@ -20,12 +20,11 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.rubyforge_project = "solrizer-fedora"
22
22
 
23
- s.add_dependency('solr-ruby', '>= 0.0.6')
24
- s.add_dependency('active-fedora', '>=3.2.0')
25
- s.add_dependency('rsolr', '1.0.6')
26
- s.add_dependency('solrizer', '>=1.0.0')
23
+ s.add_dependency('active-fedora', '4.0.0.rc15')#,'>=3.4.0')
24
+ # s.add_dependency('rsolr', '>=1.0.6')
25
+ # s.add_dependency('solrizer', '>=1.0.0')
27
26
  s.add_dependency('fastercsv') # this is used by solrize_objects when you pass it a csv file of pids
28
- s.add_dependency('activesupport', '>=3.0.11')
27
+ # s.add_dependency('activesupport', '>=3.0.11')
29
28
  s.add_development_dependency('jettywrapper', '>=1.1.0')
30
29
  s.add_development_dependency('rdoc')
31
30
 
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'solrizer/fedora'
4
- require 'spec'
5
- require 'spec/autorun'
4
+ require 'rspec'
6
5
 
7
6
  require 'solrizer'
8
7
 
@@ -21,9 +20,11 @@ end
21
20
 
22
21
 
23
22
 
24
- Spec::Runner.configure do |config|
23
+ RSpec.configure do |config|
25
24
 
26
25
  config.mock_with :mocha
26
+ config.color_enabled = true
27
+
27
28
 
28
29
 
29
30
  def fixture(file)
@@ -30,6 +30,28 @@ describe Solrizer::Fedora::Solrizer do
30
30
  end
31
31
 
32
32
  end
33
+
34
+ describe "find_objects" do
35
+ describe "when fedora is not sharded" do
36
+ it "should find_objects" do
37
+ @solrizer.find_objects(:limit=>2).should == ["fedora-system:ContentModel-3.0", "fedora-system:FedoraObject-3.0"]
38
+ end
39
+ end
40
+ describe "when fedora is sharded" do
41
+ before do
42
+ @mock1 = mock("connection1")
43
+ @mock2 = mock("connection2")
44
+ @solrizer.expects(:connections).returns([@mock1, @mock2])
45
+ end
46
+ it "should hit all the shards" do
47
+ @mock1.expects(:find_objects).returns("<result><resultList><objectFields><pid>one</pid></objectFields><objectFields><pid>two</pid></objectFields></resultList></result>")
48
+ @mock2.expects(:find_objects).returns("<result><resultList><objectFields><pid>three</pid></objectFields><objectFields><pid>four</pid></objectFields></resultList></result>")
49
+
50
+ @solrizer.find_objects(:limit=>2).should == ['one', 'two', 'three', 'four']
51
+ end
52
+ end
53
+
54
+ end
33
55
 
34
56
  describe "solrize_objects" do
35
57
  before do
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrizer-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
4
+ hash: 15424087
5
+ prerelease: 6
6
6
  segments:
7
- - 1
8
7
  - 2
9
- - 5
10
- version: 1.2.5
8
+ - 0
9
+ - 0
10
+ - rc
11
+ - 1
12
+ version: 2.0.0.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Matt Zumwalt
@@ -15,76 +17,30 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-03-01 00:00:00 Z
20
+ date: 2012-03-19 00:00:00 Z
19
21
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: solr-ruby
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 0
31
- - 0
32
- - 6
33
- version: 0.0.6
34
- type: :runtime
35
- version_requirements: *id001
36
22
  - !ruby/object:Gem::Dependency
37
23
  name: active-fedora
38
24
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 15
45
- segments:
46
- - 3
47
- - 2
48
- - 0
49
- version: 3.2.0
50
- type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rsolr
54
- prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
25
+ requirement: &id001 !ruby/object:Gem::Requirement
56
26
  none: false
57
27
  requirements:
58
28
  - - "="
59
29
  - !ruby/object:Gem::Version
60
- hash: 27
61
- segments:
62
- - 1
63
- - 0
64
- - 6
65
- version: 1.0.6
66
- type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: solrizer
70
- prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 23
30
+ hash: 15424139
77
31
  segments:
78
- - 1
32
+ - 4
79
33
  - 0
80
34
  - 0
81
- version: 1.0.0
35
+ - rc
36
+ - 15
37
+ version: 4.0.0.rc15
82
38
  type: :runtime
83
- version_requirements: *id004
39
+ version_requirements: *id001
84
40
  - !ruby/object:Gem::Dependency
85
41
  name: fastercsv
86
42
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
43
+ requirement: &id002 !ruby/object:Gem::Requirement
88
44
  none: false
89
45
  requirements:
90
46
  - - ">="
@@ -94,27 +50,11 @@ dependencies:
94
50
  - 0
95
51
  version: "0"
96
52
  type: :runtime
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: activesupport
100
- prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
102
- none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 17
107
- segments:
108
- - 3
109
- - 0
110
- - 11
111
- version: 3.0.11
112
- type: :runtime
113
- version_requirements: *id006
53
+ version_requirements: *id002
114
54
  - !ruby/object:Gem::Dependency
115
55
  name: jettywrapper
116
56
  prerelease: false
117
- requirement: &id007 !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
118
58
  none: false
119
59
  requirements:
120
60
  - - ">="
@@ -126,11 +66,11 @@ dependencies:
126
66
  - 0
127
67
  version: 1.1.0
128
68
  type: :development
129
- version_requirements: *id007
69
+ version_requirements: *id003
130
70
  - !ruby/object:Gem::Dependency
131
71
  name: rdoc
132
72
  prerelease: false
133
- requirement: &id008 !ruby/object:Gem::Requirement
73
+ requirement: &id004 !ruby/object:Gem::Requirement
134
74
  none: false
135
75
  requirements:
136
76
  - - ">="
@@ -140,7 +80,7 @@ dependencies:
140
80
  - 0
141
81
  version: "0"
142
82
  type: :development
143
- version_requirements: *id008
83
+ version_requirements: *id004
144
84
  description: An extension to projecthydra/solrizer that provides utilities for loading objects from Fedora Repositories and creating solr documents from them.
145
85
  email: matt.zumwalt@yourmediashelf.com
146
86
  executables: []
@@ -202,12 +142,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
142
  required_rubygems_version: !ruby/object:Gem::Requirement
203
143
  none: false
204
144
  requirements:
205
- - - ">="
145
+ - - ">"
206
146
  - !ruby/object:Gem::Version
207
- hash: 3
147
+ hash: 25
208
148
  segments:
209
- - 0
210
- version: "0"
149
+ - 1
150
+ - 3
151
+ - 1
152
+ version: 1.3.1
211
153
  requirements: []
212
154
 
213
155
  rubyforge_project: solrizer-fedora