def find(args)
if args[:docid] && args[:squery]
raise ArgumentError, "Too many parameters. Choose :docid or :squery"
elsif args[:docid]
result = read(args[:docid], 'only_eml' => true)
unless result.nil?
try_eml(result) || raise(ArgumentError, "#{args[:docid]} does not refer to eml metadata. To read other documents use read.")
end
elsif args[:squery]
results = squery(args[:squery])
doc = REXML::Document.new(results)
documents = Array.new()
doc.elements.each("/resultset/document") { |document|
docid = document.elements[1].text
documents.push(try_eml(read(docid, 'only_eml' => true)))
}
return documents.delete_if {|doc| doc == false }
end
end