unprocessedSearch (NotesAgentContext - JavaScript™)
Given selection criteria, returns documents in a database that: The current agent considers to be unprocessed Meet the selection criteria Were created or modified since the cutoff date
Defined in
NotesAgentContextSyntax
unprocessedSearch(formula:string,
limit:NotesDateTime, maxdocs:int) : NotesDocumentCollection
Parameter | Description |
---|---|
String formula |
A Domino® formula that defines the selection criteria. |
DateTime limit |
A cutoff date. |
int maxdocs |
The maximum number of documents you want returned; 0 means all matching documents. |
Return value | Description |
---|---|
DocumentCollection |
A collection of documents that are not yet processed, match the selection criteria, and were created or modified after the cutoff date. The collection is sorted by relevance with highest relevance first. |
Usage
This method is valid only for agents.How does it work?
This method works in two parts:
- First, it finds a collection of documents that the agent considers to be "unprocessed." The type of agent determines which documents are considered to be unprocessed. This document collection is identical to that returned by getUnprocessedDocuments.
- Second, it conducts a search on the unprocessed documents, and returns a collection of those documents that match the selection criteria and were created or modified since the cutoff date.
For example, in an agent that runs on all selected documents in the view, unprocessedSearch searches only the selected documents and returns those that match the selection criteria. In an agent that runs on all new and modified documents since the last run, unprocessedSearch searches only the documents that were not marked by updateProcessedDoc, and returns those that match the selection criteria.
What documents are returned?
The following table describes the documents that are returned by unprocessedSearch. Document selection occurs once, before the agent runs.
Agent runs on: | unprocessedSearch returns documents that meet all of these requirements: |
---|---|
All documents in database |
|
All new & modified documents |
|
All unread documents in view |
|
All documents in view |
|
All selected documents |
|
None | Is the current document only Using updateProcessedDoc |
For agents that run on new and modified documents, you must use updateProcessedDoc to mark each document as "processed," which ensures that a document gets processed by the agent only once (unless it's modified again). If you do not call this method for each document, the agent processes the same documents the next time it runs.
The updateProcessedDoc method marks a document as processed only for the particular agent from which it is called. Using updateProcessedDoc in one agent has no effect on the documents that another agent processes.
In all other agents and view actions, UpdateProcessedDoc has no effect.
Language cross-reference
UnprocessedSearch method in LotusScript® NotesDatabase class
unprocessedSearch method in Java™ Database class
EditSelectByDate @command function in formula language