Search code examples
javalotus-noteslotus-domino

Get modified Notes document in java from particular time


i saved all my indexed notes documents to Solr server,

so my problem is if any of my notes document is change in my .nsf database. i have to update my notes documents on Solr server.

for that i have to get last modified documents from particular time means i will provide a time as parameter then from that time i should get modified documents.

i searched about it but not getting clear idea about it to initiate my work .

it would be nice if anyone guide me .


Solution

  • If your plan is to get every documents modified since a certain date/time, the best way would be to use the search function on the Database class.

    Specify Select @All to get every documents of the database and set the last time you indexed as the second parameter. This way, Domino will get you every documents created or modified since this time.

    DateTime dt

    A start date. The method searches only documents created or modified since the start date. Can be null to indicate no start date.

    Here a small example :

      Session session = getSession();      
      Database db = session.getCurrentDatabase();
    
      Document profile = db.getProfileDocument("solrIndexer","nameOfTheDatabase");
      Item lastTimeIndexedItem = profile.getFirstItem("lastTimeYouIndexed");
      DateTime lastTimeIndexed = lastTimeIndexedItem.getDateTimeValue();
    
      DocumentCollection col = db.search("Select @All", lastTimeIndexed);
    
      // (Your code goes here)