# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # :solr_field_name => String # :solr_field_name => Array of Strings # :solr_field_name => Proc [Proc operates on record] # String = 3 digit control field number or 3 digit data field number + subfield letter puts "Unzipping data file..." system("cp #{marc_filename} #{temp_filename}.gz") system("gunzip #{temp_filename}") if tag <
'010' # control field extracted_data << field_instance[subfield] rescue nil extracted_data.compact.uniq puts "Indexing #{marc_filename}..." mapping.each do |key,value| data = value.call(record) data = extract_record_data(record, value) data = nil if data.empty? puts doc.inspect,"------" if debug connection.send(Solr::Request::AddDocument.new(doc)) unless debug puts count if count % 100 == 0 connection.send(Solr::Request::Commit.new) unless debug