File Search Library
CreateIndex Method
Example 



KellermanSoftware.FileSearchLibrary Namespace > IndexLogic Class : CreateIndex Method
Search Parameters
Create an index based on the search parameters
Syntax
'Declaration
 
Public Function CreateIndex( _
   ByVal searchParms As SearchParms _
) As Index
'Usage
 
Dim instance As IndexLogic
Dim searchParms As SearchParms
Dim value As Index
 
value = instance.CreateIndex(searchParms)
public Index CreateIndex( 
   SearchParms searchParms
)
public:
Index^ CreateIndex( 
   SearchParms^ searchParms
) 

Parameters

searchParms
Search Parameters
Remarks
When creating the index it is possible to index all known text files by simply not specifying the FilesToInclude or specify the FilesToInclude as *.* See the ValidExtensions property on the SearchParms for all the file types that can be indexed.
Example
//Setup the search parameters
SearchParms searchParms = new SearchParms();
 
//This is the directory to index
searchParms.DirectoriesToSearch.Add(@"c:\_git");
 
//Include all C# files by wildcard
searchParms.FilesToInclude.Add("*.cs");
searchParms.FileIncludeSearchType = FileSearchType.Wildcard;
 
//Set the directory to save the index
searchParms.IndexPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FileSearchLibraryCreateIndexExample");
 
//Create the index
IndexLogic indexLogic = new IndexLogic();
indexLogic.CreateIndex(searchParms);
'Setup the search parameters
Dim searchParms As New SearchParms()
 
'This is the directory to index
searchParms.DirectoriesToSearch.Add("c:\_git")
 
'Include all C# files by wildcard
searchParms.FilesToInclude.Add("*.cs")
searchParms.FileIncludeSearchType = FileSearchType.Wildcard
 
'Set the directory to save the index
searchParms.IndexPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FileSearchLibraryCreateIndexExample")
 
'Create the index
Dim indexLogic As New IndexLogic()
indexLogic.CreateIndex(searchParms)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IndexLogic Class
IndexLogic Members