UnprocessedFTSearchRange (NotesDatabase - LotusScript®)

Conducts a full-text search of the documents in a database that the current agent considers to be unprocessed.

Note: This method is new with Release 6.
Note: This method is not implemented in COM.

Defined in

NotesDatabase

Syntax

Set notesDocumentCollection = notesDatabase .UnprocessedFTSearchRange( query$ , maxdocs% , [ sortoptions% ], [ otheroptions% ], [ start&] )

Parameters

query$

String. The full-text query.

maxdocs%

Integer. The maximum number of documents you want returned from the query. Set this parameter to 0 to retrieve all documents (up to 5,000. See Full-text indexes section as follows.) that match the search criteria.

sortoptions%

Integer. Optional. Sorting options. Combine options by adding.

  • FT_DATE_ASC (64) sorts by document creation date in ascending order.
  • FT_DATE_DES (32) sorts by document creation date in descending order.
  • FT_SCORES (8) sorts by relevance score (default).

otheroptions%

Integer. Optional. Search options. Combine options by adding.

  • FT_DATABASE (8192) includes Domino® databases.
  • FT_FUZZY (16384) searches for related words. Need not be an exact match.
  • FT_FILESYSTEM (4096) includes files that are not Domino® databases.
  • FT_STEMS (512) uses stem words as the basis of the search.
  • FT_THESAURUS (1024) uses thesaurus synonyms.

start&

Long. Optional. The starting document to return.

Return value

notesDocumentCollection

NotesDocumentCollection. A collection of documents that were unprocessed and match the full-text query, sorted by the selected option.

Usage

This method is the same as UnprocessedFTSearch plus the start parameter.

This method is valid only for agent scripts and view actions and may be invoked only on NotesDatabase objects obtained from the CurrentDatabase property in NotesSession. In scripts that are not a part of an agent or view action, this method returns a NotesDocumentCollection with zero documents. When invoked on a NotesDatabase object that was not obtained from the CurrentDatabase property, this method raises an error.

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 or view action determines which documents are considered to be unprocessed. This document collection is identical to that returned by the UnprocessedDocuments property.
  • Next, it conducts a full-text search on the unprocessed documents and returns a collection of those documents that match the query.

For example, in an agent that runs on all selected documents in the view, UnprocessedFTSearch searches only the selected documents, and returns those that match the query. In an agent that runs on documents that have been created or modified since last run, UnprocessedFTSearch searches only the documents that have not been marked by the UpdateProcessedDoc method in NotesSession, and returns those that match the query.

What documents are returned?

The following table describes the documents that are returned by the UnprocessedFTSearch method. Document selection occurs once, before the agent runs.

Agent runs on

UnprocessedFTSearch returns documents that meet all of these requirements

All documents in database

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria 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 full-text search criteria 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 full-text search criteria specified in this method

All documents in view

Are in the view

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria specified in this method

All selected documents

or

View action

Are selected in the view

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria specified in this method

None

Is the current document only

Newly received mail documents

Not processed by this agent with UpdateProcessedDoc

Mailed to the database since the agent last ran

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria specified in this method

Newly modified documents

Not processed by this agent with UpdateProcessedDoc

Modified since the agent last ran

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria specified in this method

Pasted documents

Not processed by this agent with UpdateProcessedDoc

Pasted into the database since the agent last ran

Meet the search criteria specified in Agent Properties box

Meet the full-text search criteria specified in this method

Using UpdateProcessedDoc

For agents that run on new and modified documents, newly received mail documents, pasted documents, or newly modified documents, you must use the UpdateProcessedDoc method in NotesSession to mark each document as "processed," which ensures that a document gets processed by the agent only once (unless it's modified, mailed, or pasted again). If you do not call this method for each document, the agent processes the same documents the next time it runs.

UpdateProcessedDoc 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.

View actions

When used in a view action, UnprocessedFTSearch returns the same documents as an agent that runs on selected documents.

Full-text indexes

If the database is not full-text indexed, this method works, but less efficiently. To test for an index, use the IsFTIndexed property in NotesDatabase. If the full-text is not updated after changes are made, it does not fully reflect the content of the database. To create or update an index on a local database, use the UpdateFTIndex method.

This method returns a maximum of 5,000 documents by default. The Notes®.ini variable FT_MAX_SEARCH_RESULTS overrides this limit for indexed databases or databases that are not indexed but that are running in an agent on the client. For a database that is not indexed and is running in an agent on the server, you must set the TEMP_INDEX_MAX_DOC Notes®.ini variable as well. The absolute maximum is 2,147,483,647.

Options

If you don't specify any sort options, the documents are sorted by relevance score. When the collection is sorted by relevance the highest relevance appears first. To access the relevance score of each document in the collection, use FTSearchScore in NotesDocument.

If you ask for a sort by date, you don't get relevance scores. If you pass the resulting NotesDocumentCollection to a NotesNewsletter object, it formats its doclink report with either the document creation date or the relevance score, depending on the sort options.

Query syntax

To search for a word or phrase, enter the word or phrase as is, except that search keywords must be enclosed in quotes. Remember to escape quotes if you are inside a literal.

Wildcards, operators, and other syntax are permitted. For the complete syntax rules, see "Finding documents in a database" in Notes® Help.

Example