unprocessedSearch (AgentContext - Java™)
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
Syntax
public DocumentCollection unprocessedSearch(String formula, DateTime limit, int maxdocs)
throws NotesException
Parameters
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
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 |
Meet the search criteria specified in Agent Properties box Meet the formula search critieria specified in this method Meet the cutoff date specified in this method |
All new & modified documents |
Not processed by this agent with updateProcessedDoc Created or modified since the agent last ran Meet the search criteria specified in Agent Properties box Meet the formula search critieria specified in this method Meet the cutoff date specified in this method |
All unread documents in view |
Are unread and in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method |
All documents in view |
Are in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method |
All selected documents |
Are selected in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method |
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.