Examples: FTSearch method (NotesView - LotusScript®)

  1. This script performs a full-text search for the word "benchmark" in a view in WALNUT.NSF. The variable j contains the number of documents that contain "benchmark"; for example, 22.

    Dim db As New NotesDatabase( "Montreal", "walnut.nsf" )
    Dim view As NotesView
    Dim j As Long
    Set view = db.GetView( "By Date\Ascending By Main Topic" )
    j = view.FTSearch( "benchmark", 0 )
  2. This script opens the same view as the preceding example and performs a full-text search for "benchmark*." Using a wildcard lets you search for word variants (such as "benchmarks," "benchmarked," and "benchmarking"), even though the FTSearch method does not automatically search for variants.

    Dim db As New NotesDatabase( "Montreal", "walnut.nsf" )
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim j As Long
    Set view = db.GetView( "By Date\Ascending By Main Topic" )
    j = view.FTSearch( "benchmark*", 0 )
  3. This script finds all documents in a view that contain both "server" and "protocol" and places them into the For Review folder. If the folder does not exist, one will be created. When done, the script clears the search.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim j As Long
    Set db = session.CurrentDatabase
    Set view = db.GetView("All Documents")
    j = view.FTSearch( "server AND protocol", 0 )
    Set doc = view.GetFirstDocument()
    While Not(doc Is Nothing)
       Call doc.PutInFolder( "For Review", True )
       Set doc = view.GetNextDocument(doc)
    Wend
    Call view.Clear