This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Dec 5, 2011, 3:37 PM
51 Posts
topic has been resolvedResolved

update index

  • Category: Other
  • Platform: Windows
  • Release: 8.5.1
  • Role: Developer
  • Tags:
  • Replies: 9
 I've a search button on an xpage which refreshes a Panel in which I'm searching in a view.
Before searching I would like to update the index of the database of this view (if the index is not up to date) 
 How can I do this ?
Dec 5, 2011, 4:04 PM
272 Posts
Re: update index
Hi,
 
every view has a refresh() method.
 
In SSJS you can do a 
 
var view:NotesView = database.getView("searchView");  
view.refresh()
 
or you can use  the method for your datasource view directly.
 
Hope this helps
Sven
 
http://blog.hasselba.ch
Dec 5, 2011, 8:07 PM
51 Posts
Re: update index
 It's not the view I'm trying to refresh , but the index from the database.
The view refreshes fine but doesn't include the lastest items. 
Dec 6, 2011, 10:32 AM
51 Posts
Re: update index
Well I tried that also , but nothing changed. It wasn't indexed , and no error message (only 10 doc in database and 3 to index)
Are there different  ways to index a database ?
Now I'm manually indexing with ; application, prperties , index , update index. (the update frequency is immediate, but it takes more than an hour before it's indexxed if I don't do it manually)
Dec 6, 2011, 10:52 AM
272 Posts
Re: update index
Maybe this is an access problem, that's why you cannot do this from an xpage directly. In my opinion the best solution is to create a periodic agent to update the FTIndex. For one of my customers we have implemented this with a lotus script agent, here is the code:
 
Dim session as New NotesSession
Dim db as NotesDatabase
 
Set db = session.CurrentDatabase
If( db.LastModified > db.LastFTIndexed ) then
   db.UpdateFTIndex false
End if
 
This agent runs every 5 min., but you could even trigger it everytime a document is saved.
 
Hope this helps
Sven
 
 
Dec 7, 2011, 8:24 AM
261 Posts
Re: update index
Marc,
 
A Full Text index set to update "immediate" is never updated immediately. Although you can tweak the server to have some more control about the update process, it will never be updated "immediate".
 
There are a couple of workarounds for this behavior. As others pointed out in this thread a scheduled agent that runs every 5 minutes or calling db.updateFTIndex after every document change are two that might work for you. You could also write a Java Addin task for the server. Read this article for some background on that.
 
An approach I personally like is to update the FT index when needed (i.e. when the search page is opened). Read this article from Tommy Valand and download the demo to see an example of that approach (have a look at the code and look for the updateFTIndexIfContentChanged and contentChangedSinceLastFTIndex functions).
 
Mark

Dec 7, 2011, 10:16 AM
51 Posts
Re: update index
I just found out that the database that should be indexed is another database than the one I'm currently in.
How can I do the updateFTIndex on this other database on the same server? 
and also 
What access do I have to give to the user to this other database? (is creating documents enough ?) 
Dec 7, 2011, 1:19 PM
261 Posts
Re: update index
The updateFTIndex() method is a method of the database object. To update the index on another database you first have to create a database object for the other database:
 
var dbOther:NotesDatabase = session.getDatabase( "", "pathToOtherDb.nsf");   //the first parameter indicates the server: this assumes that the database is on the same server
if (dbOther.isOpen() ) {
 dbOther.updateFTIndex(false);
}

 
I don't know what access level you need to be able to perform an updateFTIndex call, but you could use the sessionAsSigner object:
 
var dbOther:NotesDatabase = sessionAsSigner.getDatabase( "", "pathToOtherDb.nsf");
 
Mark

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal