addCollection (QueryResultsProcessor - Java

Adds a pre-created DocumentCollection or ViewEntryCollection of documents to be included in the sorted and formatted results. The collection can be created by any means.

Defined in



public void addCollection(lotus.domino.Base collection, String referencename)
    throws NotesException


lotus.domino.Base collection

The pre-created DocumentCollection or ViewEntryCollection object to be included in QueryResultsProcessor execution.

String referencename

A unique name (to the QueryResultsProcessor instance) of the input collection. This name is used in returned entries when the origin of results is desired and in addFormula method calls to override the data used to create sorted column values.


// get Databases
Database db = session.getDatabase(serverName, "myDatabase1.nsf");
Database db2 = session.getDatabase(serverName, "myDatabase2.nsf");
// create objects
DominoQuery dq = db.createDominoQuery();
QueryResultsProcessor qrp = db.createQueryResultsProcessor();
// get collections
DocumentCollection dc = db.getAllUnreadDocuments();
ViewEntryCollection vec = db2.getView("myView").getAllEntries();
qrp.addCollection(dc, "collection1"); // adding a DocumentCollection
qrp.addCollection (vec, "collection2"); // adding a ViewEntryCollection
qrp.addDominoQuery(dq, "ORG = 'MyCompany'", "collection3"); // adding a DominoQuery
String json = qrp.executeToJSON(); // generate JSON