lib/libis/services/scope/search.rb in libis-services-0.1.11 vs lib/libis/services/scope/search.rb in libis-services-0.1.12

- old
+ new

@@ -24,11 +24,19 @@ def find(term, options = {}) super end - def query(term, _options = {}) - @oracle.call('kul_packages.scope_xml_meta_file_ed', [term.upcase]) + def query(term, options = {}) + + case options[:type] || 'REPCODE' + when 'REPCODE' + @oracle.call('kul_packages.scope_xml_meta_file_ed', [term.upcase]) + when 'ID' + @oracle.call('kul_packages.scope_xml_meta_file_by_id', term.to_i) + else + raise RuntimeError, "Invalid Scope search type '#{options[:type]}'" + end term = term.gsub(/[-\/]/, '_') err_file = "/nas/vol03/oracle/SCOPEP/#{term}_err.XML" md_file = "/nas/vol03/oracle/SCOPEP/#{term}_md.XML" if File.exist? err_file doc = Libis::Tools::XmlDocument.open(err_file)