createFTIndex (NotesDatabase - JavaScript)

Creates a full-text index for a database.

Defined in

NotesDatabase

Syntax

createFTIndex(options:int, recreate:boolean) : void
Parameter Description
options Combine options with addition. Specify 0 for no options.
  • NotesDatabase.FTINDEX_ATTACHED_FILES 1 to index attached files (raw text)
  • NotesDatabase.FTINDEX_ENCRYPTED_FIELDS 2 to index encrypted fields
  • NotesDatabase.FTINDEX_ALL_BREAKS 4 to index sentence and paragraph breaks
  • NotesDatabase.FTINDEX_CASE_SENSITIVE 8 to enable case-sensitive searches
  • NotesDatabase.FTINDEX_ATTACHED_BIN_FILES 16 to index attached files (binary)
recreate True removes any existing full-text index before creating one. If this parameter is false and an index exists, no action is taken.

Examples

This data binding for a multiline edit box returns the subject values for all documents containing "new" in a full-text search. The index is created if necessary.
if (database.isFTIndexed()) {
	database.updateFTIndex(false)
} else {
	database.createFTIndex(0, true)
}
var list = "";
var dc = database.FTSearch("new");
var doc = dc.getFirstDocument();
while (doc != null) {
	list = list + doc.getItemValueString("Subject") + "\n";
	var tmpdoc = dc.getNextDocument();
	doc.recycle();
	doc = tmpdoc;
}
return list
This button creates or re-creates a full-text index for the current database.
var options:int = NotesDatabase.FTINDEX_ALL_BREAKS + NotesDatabase.FTINDEX_CASE_SENSITIVE;
if (database.isFTIndexed()) {
	database.createFTIndex(options, true);
	requestScope.status = "Database index re-created";
} else {
	database.createFTIndex(options, false);
	requestScope.status = "New database index created";
}