Updating Database Full Text Search Via Lotusscript On Doc Save

I've created two databases. DB 1 creates a document (Doc a). DB2 uses
FTSearch to select a doc from DB1. However, when I setup Doc a in DB 1 and
then try searching from DB 2, it's not found. Why?

This is due to the way full text indexes are updated. The help text says that
"immediate" updates are performed "As quickly as possible after the database is

If, for example, you have both databases open at the same time and try the
search,the doc can't be found because DB 1 has not had it's FT index updated.
To solve this, put the following code as a "Save and Exit" button for the form
in DB 1.

The coding examples will force your users to use a button to save & exit, which
will also update the Full Text Search (see last line)
1. In your form for DB 1, Create a Text, hidden, Editable field, default value
"0" called Allowsave with the following code for Input Validation:

@If(@[email protected];
@If(AllowSave = "0"; @Failure("To validate and save this document, use the
\'Save and Exit\' Button!"); @Success);@Success)

2. Create a button with the following Script in the Click event:

Sub Click(Source As Button)
'Set up Session & Current Document
Dim session As New Notessession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument

'Set up the Current Database in this session
Dim db As notesdatabase
Set db=session.currentdatabase

'Update the field to allow save of doc.
Call uidoc.fieldsettext("allowsave","1")

'Save the Doc
Call uidoc.save

'Close the Doc
Call uidoc.close

'Update the Index
Call db.UpdateFTIndex( False )

End Sub

Dig Deeper on Domino Resources

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...