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.

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 last published in April 2002

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...