例: UnprocessedFTSearchRange method

次のエージェントは、選択文書を対象に実行され、ユーザーが指定した文字列を含む文書を 8 つの文書ごとにグループ分けして返します。

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Set db = session.CurrentDatabase
  REM Update full-text index
  Call db.UpdateFTIndex(True)
  REM Get query and put in quotes
  query$ = Inputbox("Enter string to search for", "Query")
  If query$ = "" Then Exit Sub
  query$ = """" & query$ & """"
  REM Get the first 8 documents that match the query
  start& = 1
  Set dc = db.UnprocessedFTSearchRange( query$, 8, _
  FT_SCORES, FT_STEMS, start&)
  While dc.Count > 0
    REM Display Subject for documents matching query
    Set doc = dc.GetFirstDocument
    While Not(doc Is Nothing)
      message$ = message$ & doc.Subject(0) & Chr(10)
      Set doc = dc.GetNextDocument(doc)
    Wend
    Messagebox message$,, _
    "Search results " & start& & " - " & start& - 1 + dc.Count
    REM Get next 8 documents that match the query
    message$ = ""
    start& = start& + 8
    Set dc = db.UnprocessedFTSearchRange(query$, 8, _
    FT_SCORES, FT_STEMS, start&)
  Wend
End Sub