次のエージェントは、ビューエントリコレクションを、文書に「Spanish leather」という語句を含むエントリのみに限定します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
db.updateFTIndex(true);
View view = db.getView("By Category");
view.setAutoUpdate(false);
ViewEntryCollection vec = view.getAllEntries();
vec.FTSearch("Spanish leather");
System.out.println("Query: ¥"" + vec.getQuery() + "¥"");
System.out.println("Number of entries = " +
vec.getCount());
ViewEntry tmpentry;
ViewEntry entry = vec.getFirstEntry();
while (entry != null) {
System.out.println("Entry is at position " +
entry.getPosition('.') + " - relevance score is " +
entry.getFTSearchScore());
tmpentry = vec.getNextEntry();
entry.recycle();
entry = tmpentry;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}