Wednesday, January 13, 2010

It's about time you update the NotesDatabase.Search documentation, IBM!

A colleague of mine was working on NotesDocumentCollections resulting from a NotesDatabase.Search. He discovered that whatever you put into the last parameter (maxDocs), all documents were returned.

Here's the documentation on the Search method:

Syntax:

Set notesDocumentCollection = notesDatabase.Search( formula$, notesDateTime, maxDocs% )

Parameters:

formula$

String. A Notes @function formula that defines the selection criteria.

notesDateTime


A cutoff date. The method searches only documents created or modified since the cutoff date. Specify Nothing to indicate no cutoff date.

maxDocs%

Integer. The maximum number of documents you want returned. Specify 0 to receive all matching documents.


The documentation on maxDocs is wrong, and IBM has been aware of the issue since Notes 4.5.

Do Quality control much?

3 comments:

Theo Heselmans (Xceed) said...

Strange, I've been using this for more than 10 years, and it works for me.
One issue is that it returns a maximum of 5000 docs.
I mostly use it with a value of 4999. If the dc.count is 4999 then I know I've reached the limit of FT search, and I switch to a regular search (slower, but at least I got ALL my docs).

Theo Heselmans (Xceed) said...

Oops, NOW (after submitting) I notice you're talking about regular search. I always use that one with a 0 value too.

Carl Tyler said...

This bit me in the past too.

http://www.iminstant.com/iminstant/iminstant.nsf/d6plinks/CTYR-77KRBX