.
HCLSoftware Business Partner
Domino Consulting Services
CRUCIAL Notes Tools
+1
212-599-2048
Domino Consulting Services
CRUCIAL Notes Tools
Domino administration
Notes development
Chat now
.
EN - English
CN - 中文
JP - 日本語
DE - Deutsch
FR - Français
BR - Português
RU - Pу́сский
IT - Italiano
IN - हिन्दी
ES - Español
KR - 한국어
ID - Indonesia
NL - Dutch
TR - Türkçe
SA - العربية
SE - Svenska
NO - Norsk
PL - Polski
TH - ไทย
DK - Dansk
MY - Malay
PH - Filipino
GR - Ελληνικά
FI - Suomi
IL - עברית
IE - Gaeilge
CZ - Čeština
UA - Українська
RO - Română
VN - Tiếng Việt
BD - বাংলা
HU - Magyar
Need a Domino Consultant? Call NotesMail +1 212-599-2048
-
HCLSoftware Business Partner
JAVA/CORBA CLASSES
Examples: FTSearch and clear methods
1. This agent full-text searches the "Transportation" view on the word "bicycle." The agent then puts the documents in the filtered view into the "Two-wheeled vehicles" folder. The agent then clears the view and puts the documents of the unfiltered view into the "Vehicles" folder.
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();
View view = db.getView("Transportation");
db.updateFTIndex(true);
int count = view.FTSearch("bicycle");
// View is filtered
if (count == 0)
System.out.println("No bicycles found");
else {
System.out.println(count + " bicycle(s) found");
Document tmpdoc;
Document doc = view.getFirstDocument();
while (doc != null) {
doc.putInFolder("Two-wheeled vehicles");
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
}
// Clear the full-text search
view.clear();
// View is no longer filtered
Document doc = view.getFirstDocument();
while (doc != null) {
doc.putInFolder("Vehicles");
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent full-text searches the "By Category" view on a word or words supplied by the user as the agent comment. The agent then prints the number of documents located and the value of the Subject item of each document in the filtered view.
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();
Agent agent = agentContext.getCurrentAgent();
String searchString = agent.getComment();
View view = db.getView("By Category");
db.updateFTIndex(true);
int count = view.FTSearch(searchString, 0);
if (count == 0)
System.out.println("Nothing found");
else {
System.out.println(count + " found");
Document tmpdoc;
Document doc = view.getFirstDocument();
while (doc != null) {
System.out.println(doc.getItemValueString("Subject"));
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
FTSearch method
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Feedback on
Help
or
Usability
?
Help on Help
All Help Contents