ReplaceFTIndex
[syntax="ls"]Const FT_INDEX_REINDEX = &H0002 ' Re-index from scratch
Const FT_INDEX_CASE_SENS = &H0004 ' Build case sensitive index
Const FT_INDEX_STEM_INDEX = &H0008 ' Build stem index
Const FT_INDEX_PSW = &H0010 ' Index paragraph & sentence breaks
Const FT_INDEX_OPTIMIZE = &H0020 ' Optimize index (e.g. for CDROM) (Not used)
Const FT_INDEX_ATT = &H0040 ' Index Attachments
Const FT_INDEX_ENCRYPTED_FIELDS = &H0080 ' Index Encrypted Fields
Const FT_INDEX_AUTOOPTIONS = &H0100 ' Get options from database
Const FT_INDEX_SUMMARY_ONLY = &H0200 ' Index summary data only
Const FT_INDEX_ATT_BINARY = &H1000 ' Index all attachments including BINARY formats
Type FTIndexStats
DocsAdded As Long
DocsUpdated As Long
DocsDeleted As Long
BytesIndexed As Long
End Type
Const wAPIModule = "NNOTES" ' Windows/32
Declare Private Function FTIndex Lib wAPIModule Alias "FTIndex" _
( Byval hDB As Long, Byval opt As Integer, Byval stopfile As String, stats As Any) As Integer
Declare Private Function FTDeleteIndex Lib wAPIModule Alias "FTDeleteIndex" _
( Byval hDB As Long) As Integer
Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _
( Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _
( Byval hDB As Long) As Integer
Sub ReplaceFTIndex(db As NotesDatabase)
If Not db.Server = "" Then Exit Sub ' must be Local
Dim hDB As Long
NSFDbOpen db.FilePath, hDB
If hDB = 0 Then Exit Sub
FTDeleteIndex hDB
Dim stats As FTIndexStats
FTIndex hDB, FT_INDEX_AUTOOPTIONS, "", stats
NSFDbClose hDB
Print "Indexed " & Cstr(stats.DocsAdded) & " documents"
End Sub[/syntax]
Const FT_INDEX_CASE_SENS = &H0004 ' Build case sensitive index
Const FT_INDEX_STEM_INDEX = &H0008 ' Build stem index
Const FT_INDEX_PSW = &H0010 ' Index paragraph & sentence breaks
Const FT_INDEX_OPTIMIZE = &H0020 ' Optimize index (e.g. for CDROM) (Not used)
Const FT_INDEX_ATT = &H0040 ' Index Attachments
Const FT_INDEX_ENCRYPTED_FIELDS = &H0080 ' Index Encrypted Fields
Const FT_INDEX_AUTOOPTIONS = &H0100 ' Get options from database
Const FT_INDEX_SUMMARY_ONLY = &H0200 ' Index summary data only
Const FT_INDEX_ATT_BINARY = &H1000 ' Index all attachments including BINARY formats
Type FTIndexStats
DocsAdded As Long
DocsUpdated As Long
DocsDeleted As Long
BytesIndexed As Long
End Type
Const wAPIModule = "NNOTES" ' Windows/32
Declare Private Function FTIndex Lib wAPIModule Alias "FTIndex" _
( Byval hDB As Long, Byval opt As Integer, Byval stopfile As String, stats As Any) As Integer
Declare Private Function FTDeleteIndex Lib wAPIModule Alias "FTDeleteIndex" _
( Byval hDB As Long) As Integer
Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _
( Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _
( Byval hDB As Long) As Integer
Sub ReplaceFTIndex(db As NotesDatabase)
If Not db.Server = "" Then Exit Sub ' must be Local
Dim hDB As Long
NSFDbOpen db.FilePath, hDB
If hDB = 0 Then Exit Sub
FTDeleteIndex hDB
Dim stats As FTIndexStats
FTIndex hDB, FT_INDEX_AUTOOPTIONS, "", stats
NSFDbClose hDB
Print "Indexed " & Cstr(stats.DocsAdded) & " documents"
End Sub[/syntax]