NotesDatabase.LastModified also includes changes to design elements. If you use the above test to fire a NotesDatabase.UpdateFTIndex, then the check, db.LastModified > db.LastFTIndexed, will return true until a document is modified in the db/the FTIndex is updated. Changes to design elements is ignored by the FT-indexing service on the server.
NotesDatabase.UpdateFTIndex is relatively expensive (I would think the more documents in the database -> The more time to check if the FTIndex should be updated). In an application of mine, I use NotesView.FTSearch to find certain content in views (to create HTML menu, etc). I use a class that updates the FT-index before it does the search. On regular pages, there is created two instances of this class. In an application with 200 documents, it takes the server ~130ms to do two calls to NotesDatabase.UpdateFTIndex, when the application is indexed. When I do performance tuning, I do changes to design elements, not content. Therefore the aforementioned test to determine if content has changed is flawed.
This is my so far best alternative to the "standard check". It takes 16ms to do twice in the aforementioned application. A savings of ~115ms.
Function contentChangedSinceLastFTIndex( db As NotesDatabase ) As Boolean
Dim session As New NotesSession
Dim lastFTIndexed As Variant
lastFTIndexed = db.LastFTIndexed
'First test (least resource-hungry)
If Not ( db.LastModified > lastFTIndexed ) Then
contentChangedSinceLastFTIndex = False
'Conclusive test - test if actual documents (not design elements)
'have been changed since last FTIndex
Dim dateFTIndexed As New NotesDateTime ( lastFTIndexed )
Dim col As NotesDocumentCollection
Set col = db.GetModifiedDocuments( dateFTIndexed )
If col.Count > 0 Then contentChangedSinceLastFTIndex = True