Index

Index class

Represents the main class for indexing documents and search through them.

public class Index : IDisposable

Constructors

Name Description
Index() Initializes a new instance of the Index class in memory.
Index(IndexSettings) Initializes a new instance of the Index class in memory with particular index settings.
Index(string) Initializes a new instance of the Index class. Creates a new or opens an existing index on disk.
Index(string, bool) Initializes a new instance of the Index class. Loads an existing index from disk if overwriteIfExists is false; creates a new index on disk otherwise.
Index(string, IndexSettings) Initializes a new instance of the Index class. Creates a new index with particular settings or opens an existing index on disk.
Index(string, IndexSettings, bool) Initializes a new instance of the Index class. Loads an existing index from disk if overwriteIfExists is false; creates a new index on disk with particular index settings otherwise.

Properties

Name Description
Dictionaries { get; } Gets the dictionary repository.
Events { get; } Gets the event hub for subscribing to events.
IndexInfo { get; } Gets the basic information on the index.
IndexSettings { get; } Gets the index settings.
Repository { get; } Gets the index repository object if the index is contained in it.

Methods

Name Description
static LoadIntoMemoryCompletely(string) Loads the entire index into memory. Any changes to the index are not automatically saved to the original folder.
static LoadIntoMemoryCompletely(string, IndexSettings) Loads the entire index into memory. Any changes to the index are not automatically saved to the original folder.
Add(string) Performs indexing operation. Adds a file or folder by an absolute or relative path. Documents from all subfolders will be indexed.
Add(string[]) Performs indexing operation. Adds files or folders by an absolute or relative path. Documents from all subfolders will be indexed.
Add(Document[], IndexingOptions) Performs indexing operation. Adds documents from file system, stream or structure.
Add(ExtractedData[], IndexingOptions) Performs indexing operation. Adds the extracted data to the index.
Add(string, IndexingOptions) Performs indexing operation. Adds a file or folder by an absolute or relative path. Documents from all subfolders will be indexed.
Add(string[], IndexingOptions) Performs indexing operation. Adds files or folders by an absolute or relative path. Documents from all subfolders will be indexed.
ChangeAttributes(AttributeChangeBatch) Applies the specified batch of attribute changes to indexed documents without reindexing during the update operation.
CheckSegments(bool) Checks the index for damaged segment files on the disk. The method fixes index functionality in the presence of damaged segments, if fixIndexFunctionality is true; does not fix - otherwise.
Delete(string[], UpdateOptions) Deletes indexed files or folders from the index. Then updates the index without deleted paths. Note that an individual document cannot be deleted from the index if it was added to the index as part of a folder.
Delete(UpdateOptions, string[]) Deletes documents indexed from streams or structures. Then updates the index without deleted documents.
Dispose() Releases all resources used by the Index.
GetAttributes(string) Gets all the attributes associated with the specified indexed document.
GetDocumentText(DocumentInfo, OutputAdapter) Generates the text of an indexed document and passes it through an output adapter.
GetDocumentText(DocumentInfo, OutputAdapter, TextOptions) Generates HTML formatted text for indexed document and transfers it through the output adapter.
GetIndexedDocument(string) Gets an indexed document by document key.
GetIndexedDocumentItems(DocumentInfo) Gets an array of nested items of the specified document (for container documents such as ZIP, OST, PST).
GetIndexedDocuments() Gets an array of all indexed documents.
GetIndexedPaths() Gets an array of indexed paths - documents or folders.
GetIndexingReports() Gets the reports on indexing operations.
GetSearchReports() Gets the reports on search operations.
Highlight(FoundDocument, Highlighter) Generates HTML formatted text with highlighted found terms.
Highlight(FoundDocument, Highlighter, HighlightOptions) Generates HTML formatted text with highlighted found terms.
Merge(Index, MergeOptions) Merges the specified index into the current index. Note that the other index will not be changed.
Merge(IndexRepository, MergeOptions) Merges indexes from the specified index repository into the current index. Note that indexes in the repository will not be changed.
Notify(Notification) Passes the specified notification object to the index to perform the notification.
Optimize() Minimizes the number of index segments by merging them one with another. This operation improves search performance.
Optimize(MergeOptions) Minimizes the number of index segments by merging them one with another. This operation improves search performance.
SaveTo(string) Saves the in-memory index to disk. Also saves the regular index to another folder. Does not change the settings of this index.
Search(SearchQuery) Searches in index.
Search(string) Searches in index.
Search(SearchImage, ImageSearchOptions) Performs a reverse image search in the index.
Search(SearchQuery, SearchOptions) Searches in index.
Search(string, SearchOptions) Searches in index.
SearchNext(ChunkSearchToken) Continues the chunk search started with method Search.
SearchNext(ChunkSearchToken, Cancellation) Continues the chunk search started with method Search.
Update() Re-indexes documents that have been changed or deleted since last update. Adds new files that have been added to the indexed folders.
Update(UpdateOptions) Re-indexes documents that have been changed or deleted since last update. Adds new files that have been added to the indexed folders.

Remarks

Learn more

Examples

The example demonstrates a typical usage of the class.

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
string query = "Einstein";

Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

SearchResult result = index.Search(query); // Searching in index

See Also