for (int i = 0; i < retrieved && added < capacity; i++) {
DocumentScoreInfo dsi = results.get(i);
Document document = collection.document(dsi.document);
System.err.println("URI: " + document.uri());
System.err.println("URI["+dsi.document+"]: " + collection.metadata(dsi.document).get(PropertyBasedDocumentFactory.MetadataKeys.URI));
final String docno = (String) collection.metadata(dsi.document).get(PropertyBasedDocumentFactory.MetadataKeys.URI);
// If it was not a discarded document
if (discardedDocuments == null
|| !discardedDocuments.contains(docno)) {
output.format("%s Q0 %s %d %g %s%n", topicId, docno, i,