Examples: FTSearch method and Query and FTSearchScore properties
This agent limits a view entry collection to those entries whose documents contain the phrase, "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();
}
}
}