Examples: unprocessedFTSearchRange method

This agent, which runs on selected documents, returns the selected documents that contain a specified string, in groups of eight.

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();
    }
  }
}