例: unprocessedFTSearchRange method

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

import lotus.domino.*;
import java.util.Vector;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      
      // Get query string and put in quotes
      String query = "foo";
      query = "¥"" + query + "¥"";// Get first 8 documents that match the query
      int start = 1;
      DocumentCollection dc =
        agentContext.unprocessedFTSearchRange(
          query, 8, Database.FT_SCORES,
            Database.FT_STEMS, start);
      while (dc.getCount() > 0) {
        System.out.println("Documents " + start + " though " +
          (start + dc.getCount() - 1));
        Document doc = dc.getFirstDocument();
        while (doc != null) {
          System.out.println(
            "¥t" + doc.getItemValueString("Subject"));
          doc = dc.getNextDocument(doc);
        }
        // Get next 8 documents that match query
        start = start + 8;
        dc = agentContext.unprocessedFTSearchRange(
          query, 8, Database.FT_SCORES,
            Database.FT_FUZZY, start);
      }

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}