Tip

Create FTindex with script

This functions uses API calls to be able to use all options. LotusScript only offers a limited amount of FT options.
Declarations needed:

 Const FT_INDEX_REINDEX=&H0002 Const FT_INDEX_CASE_SENS=&H0004 Const FT_INDEX_STEM_INDEX=&H0008 Const FT_INDEX_PSW=&H0010 Const FT_INDEX_OPTIMIZE=&H0020 Const FT_INDEX_ATT=&H0040 Const FT_INDEX_ENCRYPTED_FIELDS =&H0080 Const FT_INDEX_AUTOOPTIONS=&H0100 Const FT_INDEX_SUMMARY_ONLY=&H0200 Const FT_INDEX_ATT_BINARY=&H1000 Declare Function APINSFDbOpen Lib "nnotes" Alias "NSFDbOpen" ( Byval dbName As
String, hdb As Long ) As Integer Declare Function APINSFDbClose Lib "nnotes" Alias "NSFDbClose" ( Byval hdb As
Long ) As Integer Declare Function APIFtIndex Lib "nnotes" Alias "FTIndex" (Byval dbhandle As
Long, Byval Options As Integer, stopfile As String,stats As Integer) As Integer Function needed: Function CreateFT(dbpath As String,options As Integer) As Integer Dim dbhandle As Long Dim retval As Long ' return value Dim retvalFT As Long ' return value Dim dbname As String Dim RepUNID As String Dim DatabasePath As String Dim s As New NotesSession On Error Resume Next 'Make sure that index is also created from scratch if the index already exists
options=options Or FT_INDEX_REINDEX Set db=s.GetDatabase(s.currentdatabase.server,dbpath) If Not (db Is Nothing) Then DatabasePath=db.FilePath Else Msgbox("Database could not be found") CreateFT=False Exit Function End If RetVal=APINSFDbOpen (Databasepath, dbhandle ) If RetVal=0 Then RetValFT= APIFtIndex (dbhandle,options, &H0,&H0) RetVal= APINSFDbClose(dbhandle ) If Retval=0 Then Msgbox("OK") Else Msgbox("FT index could not be create or updated") CreateFT=False Exit Function End If Else Msgbox("DB could not be openend") CreateFT=False Exit Function End If End Function HOW TO CALL EXAMPLE: RetVal=CreateFT("path of database",FT_INDEX_ATT Or FT_INDEX_ENCRYPTED_FIELDS)

Only limitation is that the database should reside on same server as where script is run of on local.

Example can be expanded with the buildpath function as exist in the notesapi.

Have fun, Ronald

This was first published in April 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.