I’m not certain that this exists in more versions than 6.5.3 or my expectations of it are wrong, but when I use the “maxdocs” parameter of notesdatabase.Search, it has no effect on the number of documents in the collection, other than the “Count” property.
Here is a simple example
'-------
Set nc = db2.Search(“@True”,Nothing,5)
Msgbox nc.Count
Set doc = nc.GetFirstDocument
While Not doc Is Nothing
counter = counter + 1
Set doc = nc.GetNextDocument(doc)
Wend
Msgbox counter
'--------
The first msgbox will say ‘5’ as expected, however the iteration counter will give the total number of documents as if I used zero as the maxdocs parameter.
As a side note, nc.PutAllInFolder will put all 3500 documents (example figure) in the folder as well.
Subject: Bug with notesdatabase.Search maxdocs parameter
Hi Robert,
I’m just having the same problem in 6.5.1. Do you have a solution ?
Thank you
fx
Subject: RE: Bug with notesdatabase.Search maxdocs parameter
That is the expected behaviour. Maxdocs does not affect the search as such, it just flags the number of documents available in the returned collection.
Subject: RE: Bug with notesdatabase.Search maxdocs parameter
Forgive my ignorance, but what is it flagging? The only effect I’ve seen is on the property notesdocumentcollect.count
This said, any loops using a for x to collect.count would only loop what was passed into maxdocs but thats a pretty limited use of a function parameter in my mind.
The other problem I have with it, is that the help file says it will limit the number of documents returned by the search which it clearly did not.
Odd, and in my humble opinion, either unimplemented, or just a bug.
Subject: RE: Bug with notesdatabase.Search maxdocs parameter
The Count is the flag. Am I defending the behaviour? No, just explaining it. You can always GetNthDocument (Count + 1) then remove the extras from the collection with DeleteDocument and GetNextDocument if you want to use collection methods on the remainder.