[英]Delay in retriving parent document using FT Search
我在$ message id字段上使用FT搜索來檢索父文檔。我的數據庫已被FT索引。 我需要上級文件才能接受會議邀請。 在獲得會議邀請2小時后,我如何能夠檢索文檔。 需要幫忙。
String messageiD="<OFF0E85FF0.91FEF356-ON65257C97.00360343-65257C97.00361318@LocalDomain>";
if (messageiD.contains("@")) {
String[] strArr = messageiD.split("@");
messageiD = strArr[0].replace("<", "");
System.out.println("message id is "+messageiD);
//return messageiD;
}
String qry = "Field $MessageID CONTAINS " + messageiD;
DocumentCollection col1 = m_database.FTSearch(qry);
System.out.println("doc col length is " +col1.getCount());
Document docOld = col1.getFirstDocument();
System.out.println(docOld.getNoteID());
如果您能夠在一小時/兩個小時后檢索到結果,則FT-Index在嘗試處理您的請求時不是最新的。 使用NotesDatabase-類的方法updateFTIndex()
可以確保它是最新的。 當然,您可以使用getLastFTIndexed()-方法來檢查它是否是最新的-這是示例-Designer-幫助中的代碼,以使用這兩種方法:
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
String title = db.getTitle();
DateTime lastDT = db.getLastFTIndexed();
DateTime nowDT = session.createDateTime("Today");
nowDT.setNow();
int daysSince =
nowDT.timeDifference(lastDT) / 86400;
if (daysSince > 2) {
System.out.println("Database \"" + title +
"\" was last full-text indexed " +
daysSince + " days ago");
System.out.println("Updating");
db.updateFTIndex(true); }
else
System.out.println("Database \"" + title +
"\" was full-text indexed less
than two days ago");
} catch(Exception e) {
e.printStackTrace();
}
附加信息:在為您定義的數據庫創建全文索引時,此索引的更新頻率。
但是:即使在對話框中選擇“立即”,這也不意味着索引將始終是最新的。 更新全文是服務器Update-任務的工作。 如果此任務要“忙”,則請求將排隊,並且可能會延遲一段時間,直到有足夠的資源來執行此工作。
服務器管理員可以通過設置notes.ini來增強全文索引更新的性能。變量“ UPDATE_FULLTEXT_THREAD”(請參閱此變量鏈接以檢查詳細信息)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.