Examples: IsFTIndexed property (NotesDatabase - LotusScript®)

  1. This script checks if the current database has a full-text index before calling the FTSearch method.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim collection As NotesDocumentCollection
    Set db = session.CurrentDatabase
    If db.IsFTIndexed Then
      Set collection = db.FTSearch( "Clay tablets", 0 )
    End If
  2. This script uses IsFTIndexed to determine which method to use to create and save a newsletter. The newsletter contains links to ten documents that have to do with "press" in the database SALES.NSF. If the database is full-text indexed, it uses FTSearch to search the database. Otherwise, it uses Search to select documents where the Body field contains "press." The newsletter is saved in the database with the form name "Search Summary."
    Dim db As New NotesDatabase( "", "sales.nsf" )
    Dim collection As NotesDocumentCollection
    Dim newsletter As NotesNewsletter
    Dim doc As NotesDocument
    Dim dateTime As NotesDateTime
    Dim maxDocs As Integer
    maxDocs = 10
    If db.IsFTIndexed Then
      Set collection = db.FTSearch( "press", maxDocs )
    Else
      Set dateTime = New NotesDateTime( "" )
      Set collection = db.Search _
      ( "@Contains( Body; ""press"" )", dateTime, maxDocs ) 
    End If
    Set newsletter = New NotesNewsletter( collection )
    Set doc = newsletter.FormatMsgWithDoclinks( db )
    doc.Form = "Search Summary"
    Call doc.Save( True, True )