Subject: RE: How to avoid the FTsearch limition?
I think that the idea of searching a particular view (as opposed to the entire database) is a good one, however, only the FTSearch method is available for a view.
Is this a ‘One Time Thing’? Or will there be an ongoing requirement to do this?
If it’s ongoing, I’d bite the bullet & create all the FTIs ahead of time, and leave them. Read on…
I’ve had a lot (read: “A LOT”) of experience lately with this exact same type of project.
Domino 6.5.4 (thru 7.0.2) is full of bugs with full text searching, (creating, searching, maintaining, etc) and I’ve got a few PMRs open with IBM right now.
If you expect that your agent will take very long, one thing that you’ll probably run into is the Chronos task will stomp all over the search, and it will crash. If you have multiple databases creating FTI at the same time, the same thing will happen, and the server CPU will climb ‘over’ 100%.
Another issue I ran into with searching multiple mail files, is that after 50 or so mail files would open, the agent would crash with a Memory Allocation Error - and the server needs to be restarted. In my case the search argument is fairly long/complex - but beware if you try it on a production mail server.
The best thing that you can do if this is a ‘One Time Thing’, is to set up a seperate (“duplicate”) server, copy all the mail files over, build the FTIs and perform the search. Minimal impact to users - both from overhead and server crashes.
Some other notes that I made:
To avoid possible conflicts with Antivirus software, exclude the directories that will be searched. (TN 1208778)
It will be helpful to build the Full Text Indexes on the server (this can be a long-running process) before running this search agent.
Check / Set the following NOTES.INI variables as needed:
FT_MAX_SEARCH_RESULTS
The default value is 5000. Maximum Value: 2,147,483,647
FTG_INDEX_LIMIT (TN 1095171)
By default, Notes will only index the first 6 Meg (6291456 bytes) of an attachment. There is no maximum.
Example: 12 Meg defined as: FTG_INDEX_LIMIT=12582912
If using a complex (or long) search argument, the agent may error out. Note the database on which the error occurred, create another search document, and Utilize the ‘Restart at specific database’.
Kill the ‘Cronos’ job
That having been said…
This is some code from my agent that I’m using to perform FTSearch of all mail databases. This subroutine checks for the existance of a FTI, creates the FTI if necessary, performs the search, and goes on. Since FTI can only be created on a local database, This agent must be called as a “RunOnServer” agent.
Again, if this agent runs for over an hour, other tasks running on the server will invariably cause it to crash. I added code to allow me to specify which database to restart the search at:
The (partial) Code:
'Find all databases in the specified folder and search for text
Set MaildbDir = New NotesDbDirectory( db.Server )
Set Maildb = MaildbDir.GetFirstDatabase( DATABASE )
Do Until Maildb Is Nothing
If Not Lcase(Left(Maildb.FilePath, 5)) = "mail\" Then Goto nextdb
'Restart
If RestartDB$ <> "" Then
If Not Lcase(RestartDB$) = Lcase(Maildb.FilePath) Then
Print "..Skipping 'Mail' file: " + Maildb.Title
Goto nextdb
End If
RestartDB$ = ""
End If
Print "Searching 'Mail' file: " + Maildb.Title
Gosub SearchDB
nextdb:
Set Maildb = MaildbDir.GetNextDatabase
Loop
’ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SearchDB:
’ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
’ CreateFTIndex works on Local Database only…
options& = FTINDEX_ATTACHED_FILES + FTINDEX_ENCRYPTED_FIELDS
If maildb.IsFTIndexed Then
‘’ Print "FTI available for: " + maildb.title
Else
Print "Creating new FTI for: " + maildb.title
Call maildb.CreateFTIndex(Clng(options&) , False) 'Need to convert to 'Long' per TN 1172696
End If
'Perform the Search
Set mailcoll = maildb.FTSearch( query$ , 0 , )
’ If mailcoll.Count > 0 Then Print “Found " + Cstr(mailcoll.Count) + " items. Copying…”
Set maildoc = mailcoll.GetFirstDocument()
While Not(maildoc Is Nothing)
'If found…
Set newDoc = MailDoc.CopyToDatabase( db )
Set maildoc = mailcoll.GetNextDocument(maildoc)
Wend
’ Works only for ‘local’ databases
Print "Deleting FTI for " + maildb.title
If maildb.IsFTIndexed Then
Call Maildb.RemoveFTIndex( )
End If
Return