public class Index extends Object
Index class is designed for storage of documents data for search through them.
Modifier and Type | Field and Description |
---|---|
Event<EventHandler<BaseIndexEventArgs>> |
ErrorHappened |
Event<EventHandler<FileIndexingEventArgs>> |
FileIndexing |
Event<EventHandler<OperationFinishedEventArgs>> |
OperationFinished |
Event<EventHandler<OperationProgressEventArgs>> |
OperationProgressChanged |
Event<EventHandler<PasswordRequiredEventArgs>> |
PasswordRequired |
Event<EventHandler<BaseIndexEventArgs>> |
StatusChanged
Occurs when index status changed.
|
Constructor and Description |
---|
Index()
Initializes a new instance of the
Index class in memory. |
Index(IndexingSettings settings)
Initializes a new instance of the
Index class in memory with selected indexing settings. |
Index(String indexFolder)
Initializes a new instance of the
Index class. |
Index(String indexFolder,
boolean overwriteIfExists)
Initializes a new instance of the
Index class. |
Index(String indexFolder,
boolean overwriteIfExists,
IndexingSettings settings)
Initializes a new instance of the
Index class. |
Index(String indexFolder,
IndexingSettings settings)
Initializes a new instance of the
Index class. |
Modifier and Type | Method and Description |
---|---|
void |
addToIndex(String item)
Adds files to index and starts indexing.
|
void |
addToIndex(String[] items)
Adds files to index and starts indexing.
|
void |
addToIndex(String[] items,
boolean updateIfNecessary)
Adds files to index and starts indexing.
|
void |
addToIndex(String[] items,
boolean updateIfNecessary,
Cancellation cancellation)
Adds files to index and starts indexing.
|
void |
addToIndex(String[] items,
Cancellation cancellation)
Adds files to index and starts indexing.
|
void |
addToIndex(String[] items,
int threads)
Adds files to index and starts multithreaded indexing .
|
void |
addToIndex(String[] items,
int threads,
boolean updateIfNecessary)
Adds files to index and starts multithreaded indexing.
|
void |
addToIndex(String[] items,
int threads,
boolean updateIfNecessary,
Cancellation cancellation)
Adds files to index and starts multithreaded indexing.
|
void |
addToIndex(String[] items,
int threads,
Cancellation cancellation)
Adds files to index and starts multithreaded indexing .
|
void |
addToIndex(String item,
boolean updateIfNecessary)
Adds files to index and starts indexing.
|
void |
addToIndex(String item,
Cancellation cancellation)
Adds files to index and starts indexing.
|
void |
addToIndex(String item,
int threads)
Adds files to index and starts multithreaded indexing.
|
void |
addToIndex(String item,
int threads,
boolean updateIfNecessary)
Adds files to index and starts multithreaded indexing.
|
void |
addToIndex(String item,
int threads,
boolean updateIfNecessary,
Cancellation cancellation)
Adds files to index and starts multithreaded indexing.
|
void |
addToIndexAsync(String item)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String[] items)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String[] items,
boolean updateIfNecessary)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String[] items,
boolean updateIfNecessary,
Cancellation cancellation)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String[] items,
Cancellation cancellation)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String[] items,
int threads)
Asynchronously adds files to index and starts multithreaded indexing
Files from all subfolders will be added to index.
|
void |
addToIndexAsync(String[] items,
int threads,
boolean updateIfNecessary)
Asynchronously adds files to index and starts multithreaded indexing.
|
void |
addToIndexAsync(String[] items,
int threads,
boolean updateIfNecessary,
Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing.
|
void |
addToIndexAsync(String[] items,
int threads,
Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing
Files from all subfolders will be added to index.
|
void |
addToIndexAsync(String item,
boolean updateIfNecessary)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String item,
boolean updateIfNecessary,
Cancellation cancellation)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String item,
Cancellation cancellation)
Asynchronously adds files to index and starts indexing.
|
void |
addToIndexAsync(String item,
int threads)
Asynchronously adds files to index and starts multithreaded indexing
Files from all subfolders will be added to index.
|
void |
addToIndexAsync(String item,
int threads,
boolean updateIfNecessary)
Asynchronously adds files to index and starts multithreaded indexing.
|
void |
addToIndexAsync(String item,
int threads,
boolean updateIfNecessary,
Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing.
|
void |
addToIndexAsync(String item,
int threads,
Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing
Files from all subfolders will be added to index.
|
void |
break_()
Break current asynchronous operation.
|
String |
extractDocumentText(DocumentInfo documentInfo,
IFieldExtractor customExtractor)
Generates HTML formatted text for indexed document.
|
void |
extractDocumentText(String fileName,
DocumentInfo documentInfo,
IFieldExtractor customExtractor)
Generates HTML formatted text for indexed document and saves it to a file.
|
protected void |
finalize()
Finalizes an instance of the
Index class. |
CustomExtractorsCollection |
getCustomExtractors()
Gets custom extractors collection.
|
DictionaryCollection |
getDictionaries()
Gets dictionary collection.
|
DocumentInfo[] |
getIndexedDocumentItems(DocumentInfo documentInfo)
Gets an array of a document items.
|
DocumentInfo[] |
getIndexedDocuments()
Gets an array of all indexed documents.
|
String |
getIndexFolder()
Gets full folder name where index is stored.
|
com.aspose.ms.System.Guid |
getIndexId()
Gets index GUID.
|
IndexingReport[] |
getIndexingReport()
Gets report about all indexing operations.
|
IndexingSettings |
getIndexingSettings()
Gets indexing setting.
|
int |
getIndexStatus()
Gets index status.
|
IndexRepository |
getRepository()
Gets index repository if index has it.
|
SearchingReport[] |
getSearchingReport()
Gets the report about all searching operations.
|
String |
getVersion()
Gets index version.
|
String |
highlightInText(DocumentResultInfo info)
Generates HTML formatted text with highlighted found terms.
|
String |
highlightInText(DocumentResultInfo info,
IFieldExtractor customExtractor,
String encoding)
Generates HTML formatted text with highlighted found terms.
|
void |
highlightInText(String fileName,
DocumentResultInfo info)
Generates HTML formatted text with highlighted found terms and saves it to a file.
|
void |
highlightInText(String fileName,
DocumentResultInfo info,
IFieldExtractor customExtractor,
String encoding)
Generates HTML formatted text with highlighted found terms and saves it to a file.
|
void |
merge()
Merge all delta indexes to one index file.
|
void |
merge(boolean updateIfNecessary)
Merge all delta indexes to one index file.
|
void |
merge(boolean updateIfNecessary,
Cancellation cancellation)
Merge all delta indexes to one index file.
|
void |
merge(Cancellation cancellation)
Merge all delta indexes to one index file.
|
void |
merge(Index mergedIndex)
Merge two indexes to one index.
|
void |
merge(Index mergedIndex,
boolean updateIfNecessary)
Merge two indexes to one index.
|
void |
merge(Index mergedIndex,
boolean updateIfNecessary,
Cancellation cancellation)
Merge two indexes to one index.
|
void |
merge(IndexRepository repository)
Merge indexes with indexes from index repository.
|
void |
merge(IndexRepository repository,
boolean updateIfNecessary)
Merge indexes with indexes from index repository.
|
void |
merge(IndexRepository repository,
boolean updateIfNecessary,
Cancellation cancellation)
Merge indexes with indexes from index repository.
|
void |
mergeAsync()
Merge all delta indexes to one index file asynchronously.
|
void |
mergeAsync(boolean updateIfNecessary)
Merge all delta indexes to one index file asynchronously.
|
void |
mergeAsync(boolean updateIfNecessary,
Cancellation cancellation)
Merge all delta indexes to one index file asynchronously.
|
void |
mergeAsync(Index mergedIndex)
Merge two indexes to one index.
|
void |
mergeAsync(Index mergedIndex,
boolean updateIfNecessary)
Merge two indexes to one index.
|
void |
mergeAsync(Index mergedIndex,
boolean updateIfNecessary,
Cancellation cancellation)
Merge two indexes to one index.
|
void |
mergeAsync(IndexRepository repository)
Merge indexes with indexes from index repository asynchronously.
|
void |
mergeAsync(IndexRepository repository,
boolean updateIfNecessary)
Merge indexes with indexes from index repository asynchronously.
|
void |
mergeAsync(IndexRepository repository,
boolean updateIfNecessary,
Cancellation cancellation)
Merge indexes with indexes from index repository asynchronously.
|
SearchResults |
search(ChunkSearchToken chunkSearchToken)
Searches in index.
|
SearchResults |
search(ChunkSearchToken chunkSearchToken,
Cancellation cancellation)
Searches in index.
|
SearchResults |
search(SearchQuery query,
SearchParameters searchParameters)
Searches in index.
|
SearchResults |
search(SearchQuery query,
SearchParameters searchParameters,
Cancellation cancellation)
Searches in index.
|
SearchResults |
search(String query)
Searches in index.
|
SearchResults |
search(String query,
SearchParameters searchParameters)
Searches in index.
|
SearchResults |
search(String query,
SearchParameters searchParameters,
Cancellation cancellation)
Searches in index.
|
void |
update()
Updates information about indexed files and folders.
|
void |
update(Cancellation cancellation)
Updates information about indexed files and folders.
|
void |
updateAsync()
Updates information about indexed files and folders asynchronously.
|
void |
updateAsync(Cancellation cancellation)
Updates information about indexed files and folders asynchronously.
|
public final Event<EventHandler<OperationFinishedEventArgs>> OperationFinished
public final Event<EventHandler<BaseIndexEventArgs>> ErrorHappened
public final Event<EventHandler<OperationProgressEventArgs>> OperationProgressChanged
public final Event<EventHandler<PasswordRequiredEventArgs>> PasswordRequired
public final Event<EventHandler<FileIndexingEventArgs>> FileIndexing
public final Event<EventHandler<BaseIndexEventArgs>> StatusChanged
Occurs when index status changed.
public Index()
Initializes a new instance of the Index
class in memory.
The following is an example of Creating index in memory without saving files to disk.Index index = new Index();
public Index(IndexingSettings settings)
Initializes a new instance of the Index
class in memory with selected indexing settings.
The following is an example of Creating index in memory without saving files to disk.bool quickIndexing = true; IndexingSettings settings = new IndexingSettings(quickIndexing); Index index = new Index(settings);
settings
- Indexing settings.public Index(String indexFolder)
Initializes a new instance of the Index
class.
Creates or opens existing index on disk.
The following is an example of Creating index on disk or loading index from disk if it exists.string indexFolder = @"c:\MyIndex\"; Index index = new Index(indexFolder);
indexFolder
- Path to index folder.public Index(String indexFolder, IndexingSettings settings)
Initializes a new instance of the Index
class.
Creates index on disk with selected indexing settings.
Index will be rewritten if it already exists in selected folder.
Selected index settings will be ignored if overwriteIfExists is false and index exists in indexFolder.
The following is an example of Creating index on disk or loading index from disk if it exists.bool quickIndexing = true; IndexingSettings settings = new IndexingSettings(quickIndexing); string indexFolder = @"c:\MyIndex\"; Index index = new Index(indexFolder, settings);
indexFolder
- Path to index folder.settings
- Indexing settings.public Index(String indexFolder, boolean overwriteIfExists)
Initializes a new instance of the Index
class.
Creates index on disk or loads existing index from disk.
Index will be rewritten if it already exists in selected folder and overwriteIfExists is true.
The following is an example of Creating index on disk with rewriting already created index if it exists.Index index = new Index(@"c:\MyIndex\", true); // Create new index or load it if it exists in folder c:\MyIndex
The following is an example of Loading index from disk if it exists or creating if indexfolder is emptyIndex index = new Index(@"c:\MyIndex\", false); // Create new index. Already created inde in folder c:\MyIndex will be owerwriten.
indexFolder
- Path to index folder.overwriteIfExists
- If index folder contain index it will be overwritten.public Index(String indexFolder, boolean overwriteIfExists, IndexingSettings settings)
Initializes a new instance of the Index
class.
Creates index on disk or loads existing index from disk with the selected indexing settings.
Index will be rewritten if it already exists in selected folder and overwriteIfExists is true.
Selected index settings will be ignored if overwriteIfExists is false and index exists in indexFolder.
The following is an example of Creating index on disk with rewriting already created index if it existsbool quickIndexing = true; IndexingSettings settings = new IndexingSettings(quickIndexing); Index index = new Index(@"c:\MyIndex\", true, settings); // Create new index or load it if it exists in folder c:\MyIndex
The following is an example of Loading index from disk if it exists or creating if indexfolder is emptybool quickIndexing = true; IndexingSettings settings = new IndexingSettings(quickIndexing); Index index = new Index(@"c:\MyIndex\", false, settings); // Create new index. Already created inde in folder c:\MyIndex will be owerwriten.
indexFolder
- Path to index folder.overwriteIfExists
- If index folder contains index it will be overwritten.settings
- Indexing settings.protected void finalize() throws Throwable
Finalizes an instance of the Index
class.
public final com.aspose.ms.System.Guid getIndexId()
Gets index GUID.
Value: The index GUID.public final String getIndexFolder()
Gets full folder name where index is stored.
Value: The index folder.public final IndexRepository getRepository()
Gets index repository if index has it.
Value: The repository.public final IndexingSettings getIndexingSettings()
Gets indexing setting.
Value: The indexing settings.public final int getIndexStatus()
Gets index status.
Value: The index status.public final CustomExtractorsCollection getCustomExtractors()
Gets custom extractors collection.
Value: The custom extractors collection.public final String getVersion()
Gets index version.
Value: The index version.public final DictionaryCollection getDictionaries()
Gets dictionary collection.
Value: The dictionary collection.public final void addToIndex(String item, Cancellation cancellation)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // indexing selected folder index.AddToIndex(fileName); // indexing selected file
item
- File or folder with files for indexing.cancellation
- The cancellation indicator.public final void addToIndex(String item)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // indexing selected folder index.AddToIndex(fileName); // indexing selected file
item
- File or folder with files for indexing.public final void addToIndex(String item, int threads)
Adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments, threadCount); // multithreaded indexing selected folder index.AddToIndex(fileName, threadCount); // multithreaded indexing selected file
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.public final void addToIndex(String item, boolean updateIfNecessary)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(folderWithDocuments, true); // Add to index selected folder and update index version if it is old index.AddToIndex(fileName, false); // Add to index selected file
item
- File or folder with files for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndex(String item, int threads, boolean updateIfNecessary)
Adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(folderWithDocuments, threadCount, true); // Add to index selected folder and update index version if it is old index.AddToIndex(fileName, threadCount, false); // Add to index selected file
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndex(String item, int threads, boolean updateIfNecessary, Cancellation cancellation)
Adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(folderWithDocuments, threadCount, true); // Add to index selected folder and update index version if it is old index.AddToIndex(fileName, threadCount, false); // Add to index selected file
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndexAsync(String item)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments); // indexing selected folder asynchronously
item
- File or folder with files for indexing.public final void addToIndexAsync(String item, Cancellation cancellation)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments); // indexing selected folder asynchronously
item
- File or folder with files for indexing.cancellation
- The cancellation indicator.public final void addToIndexAsync(String item, int threads)
Asynchronously adds files to index and starts multithreaded indexing Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, threadCount); // Add to index selected folder asynchronously
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.public final void addToIndexAsync(String item, int threads, Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, threadCount); // Add to index selected folder asynchronously
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.cancellation
- The cancellation indicator.public final void addToIndexAsync(String item, boolean updateIfNecessary)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, true); // Add to index selected folder asynchronously and update index up to actual version if it necessary
item
- File or folder with files for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndexAsync(String item, boolean updateIfNecessary, Cancellation cancellation)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, true); // Add to index selected folder asynchronously and update index up to actual version if it necessary
item
- File or folder with files for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndexAsync(String item, int threads, boolean updateIfNecessary)
Asynchronously adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, threadCount, true); // Add to index selected folder asynchronously and update index up to actual version if it necessary
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndexAsync(String item, int threads, boolean updateIfNecessary, Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of Adding documents to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; int threadCount = 2; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments, threadCount, true); // Add to index selected folder asynchronously and update index up to actual version if it necessary
item
- File or folder with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndex(String[] items)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(items);
items
- Files of folders with files for indexing.public final void addToIndex(String[] items, Cancellation cancellation)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(items);
items
- Files of folders with files for indexing.cancellation
- The cancellation indicator.public final void addToIndex(String[] items, int threads)
Adds files to index and starts multithreaded indexing . Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(items, threadCount); // starting multithreaded indexing.
items
- Files of folders with files for indexing.threads
- The number of threads that will be used for indexing.public final void addToIndex(String[] items, int threads, Cancellation cancellation)
Adds files to index and starts multithreaded indexing . Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(items, threadCount); // starting multithreaded indexing.
items
- Files of folders with files for indexing.threads
- The number of threads that will be used for indexing.cancellation
- The cancellation indicator.public final void addToIndex(String[] items, boolean updateIfNecessary)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(items, true); // Add frolders to index and update index if it is not actual version
items
- Files of folders with files for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndex(String[] items, boolean updateIfNecessary, Cancellation cancellation)
Adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(items, true); // Add frolders to index and update index if it is not actual version
items
- Files of folders with files for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndex(String[] items, int threads, boolean updateIfNecessary)
Adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(items, threadCount, true); // Add folders to index and update index if it is not actual version
items
- Files of folders with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndex(String[] items, int threads, boolean updateIfNecessary, Cancellation cancellation)
Adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders with files to index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string fileName = @"c:\MyOtherDocuments\MyFile.txt"; int threadCount = 2; string[] items = new string[] { folderWithDocuments, anotherFolderWithDocuments, fileName }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.AddToIndex(items, threadCount, true); // Add folders to index and update index if it is not actual version
items
- Files of folders with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndexAsync(String[] items)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
items
- Files or folders with files for indexing.public final void addToIndexAsync(String[] items, Cancellation cancellation)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
items
- Files or folders with files for indexing.cancellation
- The cancellation indicator.public final void addToIndexAsync(String[] items, int threads)
Asynchronously adds files to index and starts multithreaded indexing Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; int threadCount = 2; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, threadCount); // Add frolders to index asynchronously
items
- Files or folders with files for indexing.threads
- The number of threads that will be used for indexing.public final void addToIndexAsync(String[] items, int threads, Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; int threadCount = 2; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, threadCount); // Add frolders to index asynchronously
items
- Files or folders with files for indexing.threads
- The number of threads that will be used for indexing.cancellation
- The cancellation indicator.public final void addToIndexAsync(String[] items, boolean updateIfNecessary)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, true); // Add frolders to index asynchronously and update index if it is not actual version
items
- Files or folders with files for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndexAsync(String[] items, boolean updateIfNecessary, Cancellation cancellation)
Asynchronously adds files to index and starts indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, true); // Add frolders to index asynchronously and update index if it is not actual version
items
- Files or folders with files for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void addToIndexAsync(String[] items, int threads, boolean updateIfNecessary)
Asynchronously adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; int threadCount = 2; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, threadCount, true); // Add frolders to index asynchronously and update index if it is not actual version
items
- Files or folders with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarypublic final void addToIndexAsync(String[] items, int threads, boolean updateIfNecessary, Cancellation cancellation)
Asynchronously adds files to index and starts multithreaded indexing. Files from all subfolders will be added to index.
The following is an example of adding several files and folders to index asynchronously.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string anotherFolderWithDocuments = @"c:\MyData\"; int threadCount = 2; string[] folders = new string[] { folderWithDocuments, anotherFolderWithDocuments }; Index index = new Index(folderForIndex); // Load index from c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // This event will inform when the indexing is complete index.AddToIndexAsync(folders, threadCount, true); // Add frolders to index asynchronously and update index if it is not actual version
items
- Files or folders with files for indexing.threads
- The number of threads that will be used for indexing.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void update()
Updates information about indexed files and folders. Changed files will be re-indexed. Deleted files will be marked as deleted and will not be added to search results. New files in indexed folders will be added to index.
The following is an example of Updating current index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder // Delete files from c:\MyDocuments\ or modify them or add new files to c:\MyDocuments\ index.Update(); // Checking all indexed files for deleting or modification and checking for new files in folder and update index
public final void update(Cancellation cancellation)
Updates information about indexed files and folders. Changed files will be re-indexed. Deleted files will be marked as deleted and will not be added to search results. New files in indexed folders will be added to index.
The following is an example of Updating current index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder // Delete files from c:\MyDocuments\ or modify them or add new files to c:\MyDocuments\ index.Update(); // Checking all indexed files for deleting or modification and checking for new files in folder and update index
cancellation
- The cancellation indicator.public final void updateAsync()
Updates information about indexed files and folders asynchronously. Changes files will be re-indexed. Deleted files will be marked as deleted and will not be added to search results. New files in indexed folders will be added to index.
The following is an example of Updating current index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder // Delete files from c:\MyDocuments\ or modify them or add new files to c:\MyDocuments\ index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.UpdateAsync(); // Checking all indexed files for deleting or modification and checking for new files in folderf and update index
public final void updateAsync(Cancellation cancellation)
Updates information about indexed files and folders asynchronously. Changes files will be re-indexed. Deleted files will be marked as deleted and will not be added to search results. New files in indexed folders will be added to index.
The following is an example of Updating current index.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder // Delete files from c:\MyDocuments\ or modify them or add new files to c:\MyDocuments\ index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.UpdateAsync(); // Checking all indexed files for deleting or modification and checking for new files in folderf and update index
cancellation
- The cancellation indicator.public final IndexingReport[] getIndexingReport()
Gets report about all indexing operations.
The following is an example how to get indexing report.string indexFolder = @"c:\MyIndex\"; string documentsFolder = @"c:\MyDocuments\"; Index index = new Index(indexFolder); // Creating index in c:\MyIndex\ folder index.AddToIndex(documentsFolder); // Run indexing files from c:\MyDocuments\ folder // Delete files from c:\MyDocuments\ or modify them or add new files to c:\MyDocuments\ // Get indexing report IndexingReport[] report = index.GetIndexingReport();
public final SearchingReport[] getSearchingReport()
Gets the report about all searching operations.
The following is an example how to get searching report.string indexFolder = @"c:\MyIndex"; string documentsFolder = @"c:\MyDocuments"; Index index = new Index(indexFolder); index.AddToIndex(documentsFolder); SearchResults results1 = index.Search(query1, params1); SearchResults results2 = index.Search(query2, params2); SearchResults results3 = index.Search(query3, params3); // Get searching report SearchingReport[] report = index.GetSearchingReport(); foreach (SearchingReport record in report) { Console.WriteLine("Searching takes {0}, {1} results was found. ", record.SearchingTime, record.ResultCount); }
public final SearchResults search(String query)
Searches in index.
The following is an example of Simple Search.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder string query = "search query"; SearchResults searchResults = index.Search(query);
The following is an example of Regex Search.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder string regexQuery = "^[a-zA-Z0-9]+"; // regex in query should starts with ^ SearchResults searchResults = index.Search(regexQuery);
The following is an example of Faceted Search.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder string query = "content:word1"; // SearchResults searchResults = index.Search(query);
query
- The search query.public final SearchResults search(String query, SearchParameters searchParameters)
Searches in index.
The following is an example of Fuzzy Searchstring folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder SearchParameters parameters = new SearchParameters(); parameters.FuzzySearch = new FuzzySearchParameters { Enabled = true }; string query = "fuzzy search query"; SearchResults searchResults = index.Search(query, parameters);
The following is an example of Synonym Searchstring folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; string fileWithSynonyms = @"c:\synonyms.txt"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.AddToIndex(folderWithDocuments); // Run indexing files from c:\MyDocuments\ folder index.LoadSynonyms(fileWithSynonyms); // load synonyms to index SearchParameters parameters = new SearchParameters(); parameters.UseSynonymSearch = true; string query = "synonym search query"; SearchResults searchResults = index.Search(query, parameters);
query
- The search query.searchParameters
- The search parameters.public final SearchResults search(String query, SearchParameters searchParameters, Cancellation cancellation)
Searches in index.
query
- The search query.searchParameters
- The search parameters.cancellation
- The cancellation indicator.public final SearchResults search(SearchQuery query, SearchParameters searchParameters)
Searches in index.
query
- The search query.searchParameters
- The search parameters.public final SearchResults search(SearchQuery query, SearchParameters searchParameters, Cancellation cancellation)
Searches in index.
query
- The search query.searchParameters
- The search parameters.cancellation
- The cancellation indicator.public final SearchResults search(ChunkSearchToken chunkSearchToken)
Searches in index.
chunkSearchToken
- The chunk search token.public final SearchResults search(ChunkSearchToken chunkSearchToken, Cancellation cancellation)
Searches in index.
chunkSearchToken
- The chunk search token.cancellation
- The cancellation indicator.public final void merge()
Merge all delta indexes to one index file. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file index.Merge();
public final void merge(Cancellation cancellation)
Merge all delta indexes to one index file. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file index.Merge();
cancellation
- The cancellation indicator.public final void merge(boolean updateIfNecessary)
Merge all delta indexes to one index file. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file // If index has not actual version it will be updated to actual index.Merge(true);
updateIfNecessary
- Update index version if it is necessary.public final void merge(boolean updateIfNecessary, Cancellation cancellation)
Merge all delta indexes to one index file. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file // If index has not actual version it will be updated to actual index.Merge(true);
updateIfNecessary
- Update index version if it is necessary.cancellation
- The cancellation indicator.public final void merge(Index mergedIndex)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexesstring indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified index1.Merge(index2);
mergedIndex
- The merged index.public final void merge(Index mergedIndex, boolean updateIfNecessary)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexesstring indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified // If some of merged indexes have not actual version they will be updated to actual index1.Merge(index2, true);
mergedIndex
- The merged index.updateIfNecessary
- Update index version if it is necessarypublic final void merge(Index mergedIndex, boolean updateIfNecessary, Cancellation cancellation)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexesstring indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified // If some of merged indexes have not actual version they will be updated to actual index1.Merge(index2, true);
mergedIndex
- The merged index.updateIfNecessary
- Update index version if it is necessarycancellation
- The cancellation indicator.public final void merge(IndexRepository repository)
Merge indexes with indexes from index repository.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index.After merge index repository dtay unmodified mainIndex.Merge(indexRepository);
repository
- The merged index repository.public final void merge(IndexRepository repository, boolean updateIfNecessary)
Merge indexes with indexes from index repository.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index. After merge index repository stay unmodified // If some of merged indexes have not actual version they will be updated to actual mainIndex.Merge(indexRepository, true);
repository
- The merged index repository.updateIfNecessary
- Update index version if it is necessary.public final void merge(IndexRepository repository, boolean updateIfNecessary, Cancellation cancellation)
Merge indexes with indexes from index repository.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index. After merge index repository stay unmodified // If some of merged indexes have not actual version they will be updated to actual mainIndex.Merge(indexRepository, true);
repository
- The merged index repository.updateIfNecessary
- Update index version if it is necessary.cancellation
- The cancellation indicator.public final void mergeAsync()
Merge all delta indexes to one index file asynchronously. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file index.MergeAsync();
public final void mergeAsync(boolean updateIfNecessary)
Merge all delta indexes to one index file asynchronously. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file index.MergeAsync(true);
updateIfNecessary
- Update index version if it is necessary.public final void mergeAsync(boolean updateIfNecessary, Cancellation cancellation)
Merge all delta indexes to one index file asynchronously. If index has delta indexes, merging can improve search performance.
The following is an example of Merging current index.string indexName = "MyIndex"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating index Index index = new Index(indexName, true); // Adding documents to index index.AddToIndex(myDocumentsFolder1); // Adding one more folder to index. delta index will be created index.AddToIndex(myDocumentsFolder2); // Run merging. All delta indexes merged to one file index.MergeAsync(true);
updateIfNecessary
- Update index version if it is necessary.cancellation
- The cancellation indicator.public final void mergeAsync(Index mergedIndex)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexes asynchronously.string indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified index1.MergeAsync(index2);
mergedIndex
- The merged index.public final void mergeAsync(Index mergedIndex, boolean updateIfNecessary)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexes asynchronously.string indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified index1.MergeAsync(index2, true);
mergedIndex
- The merged index.updateIfNecessary
- Update index version if it is necessary.public final void mergeAsync(Index mergedIndex, boolean updateIfNecessary, Cancellation cancellation)
Merge two indexes to one index.
The following is an example of Merging current index with list of other indexes asynchronously.string indexName1 = "MyIndex1"; string indexName2 = "MyIndex2"; string myDocumentsFolder1 = @"c:\My Documents1\"; string myDocumentsFolder2 = @"c:\My Documents2\"; // Creating first index Index index1 = new Index(indexName1,true); // Add documents to first index index1.AddToIndex(myDocumentsFolder1); // Creating second index Index index2 = new Index(indexName2,true); // Add documents to second index index2.AddToIndex(myDocumentsFolder2); // Merge indexes. All data from index2 will merged to index1. Index2 will stay unmodified index1.MergeAsync(index2, true);
mergedIndex
- The merged index.updateIfNecessary
- Update index version if it is necessary.cancellation
- The cancellation indicator.public final void mergeAsync(IndexRepository repository)
Merge indexes with indexes from index repository asynchronously.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index.After merge index repository dtay unmodified mainIndex.MergeAsync(indexRepository);
repository
- The indexes repository.public final void mergeAsync(IndexRepository repository, boolean updateIfNecessary)
Merge indexes with indexes from index repository asynchronously.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index.After merge index repository dtay unmodified mainIndex.MergeAsync(indexRepository, true);
repository
- The indexes repository.updateIfNecessary
- Update index version if it is necessary.public final void mergeAsync(IndexRepository repository, boolean updateIfNecessary, Cancellation cancellation)
Merge indexes with indexes from index repository asynchronously.
The following is an example of Merging current index with index repository.IndexRepository indexRepository = new IndexRepository(); Index index1 = indexRepository.Create("IndexForMerging1"); index1.AddToIndex(@"c:\MyDocuments1"); Index index2 = indexRepository.Create("IndexForMerging2"); index2.AddToIndex(@"c:\MyDocuments2"); Index mainIndex = new Index("MainIndexName"); mainIndex.AddToIndex(@"c:\MyDocuments3"); // Merge data from indexes in repository to main index.After merge index repository dtay unmodified mainIndex.MergeAsync(indexRepository, true);
repository
- The indexes repository.updateIfNecessary
- Update index version if it is necessary.cancellation
- The cancellation indicator.public final String highlightInText(DocumentResultInfo info)
Generates HTML formatted text with highlighted found terms.
info
- The document result info with the found terms.public final String highlightInText(DocumentResultInfo info, IFieldExtractor customExtractor, String encoding)
Generates HTML formatted text with highlighted found terms.
info
- The document result info with the found terms.customExtractor
- The custom text extractor.encoding
- The encoding for text file.public final void highlightInText(String fileName, DocumentResultInfo info)
Generates HTML formatted text with highlighted found terms and saves it to a file.
fileName
- The file to save formatted text to.info
- The document result info with the found terms.public final void highlightInText(String fileName, DocumentResultInfo info, IFieldExtractor customExtractor, String encoding)
Generates HTML formatted text with highlighted found terms and saves it to a file.
fileName
- The file to save formatted text to.info
- The document result info with the found terms.customExtractor
- The custom text extractor.encoding
- The encoding for text file.public final void break_()
Break current asynchronous operation.
The following is an example of breaking asynchronous indexing operation.string folderForIndex = @"c:\MyIndex\"; string folderWithDocuments = @"c:\MyDocuments\"; Index index = new Index(folderForIndex); // Creating index in c:\MyIndex\ folder index.OperationFinished += index_OperationFinished; // Subscribing on Operation Finished event index.AddToIndexAsync(folderWithDocuments); // indexing selected folder asynchronously index.Break(); // Breaking indexing
public final DocumentInfo[] getIndexedDocuments()
Gets an array of all indexed documents.
public final DocumentInfo[] getIndexedDocumentItems(DocumentInfo documentInfo)
Gets an array of a document items.
documentInfo
- A document info.public final String extractDocumentText(DocumentInfo documentInfo, IFieldExtractor customExtractor)
Generates HTML formatted text for indexed document.
documentInfo
- The document info.customExtractor
- The custom text extractor.public final void extractDocumentText(String fileName, DocumentInfo documentInfo, IFieldExtractor customExtractor)
Generates HTML formatted text for indexed document and saves it to a file.
fileName
- The file to save formatted text to.documentInfo
- The document info.customExtractor
- The custom text extractor.Copyright © 2019. All rights reserved.