简体   繁体   中英

Delay in retriving parent document using FT Search

i am using FT search on $message id field to retrieve the parent document.my database is FT indexed. i need the parent document for accepting the meeting invitation. how ever i am able to retrieve document after 2 hours of getting meeting invitation. need help.

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

If you are able to retrieve the result one hour / two hours later, then the FT- Index is not up to date, when it tries to process your request. Use method updateFTIndex() of NotesDatabase- class to make sure, it is up to date. Of course you can check, if it IS up to date, using getLastFTIndexed()- Method... Here is example- code from the Designer- Help to use these two methods:

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

Additional Information: When creating a fulltext index for a database you define, how often this index is updated.

But: Even when selecting "Immediate" in the dialog, this does not mean, that the index will always be up to date. Updating the fulltext is a job of the Update- task of the server. If this task is to "busy" then the request is queued and might be delayed for some time until there are resources available for doing the job.

The performance of fulltextindex updates can be enhanced by the server admin by setting a notes.ini- Variable "UPDATE_FULLTEXT_THREAD" (see this link about the variable to check details).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM