Index Class
Represents the main class for indexing documents and search through them.
Inheritance Hierarchy
SystemObject
  GroupDocs.SearchIndex

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 19.10.1
Syntax
public class Index : IDisposable

The Index type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleIndex
Initializes a new instance of the Index class in memory.
Public methodCode exampleIndex(String)
Initializes a new instance of the Index class. Creates a new or opens an existing index on disk.
Public methodCode exampleIndex(IndexSettings)
Initializes a new instance of the Index class in memory with particular index settings.
Public methodCode exampleIndex(String, IndexSettings)
Initializes a new instance of the Index class. Creates a new index with particular settings or opens an existing index on disk.
Public methodCode exampleIndex(String, Boolean)
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.
Public methodCode exampleIndex(String, IndexSettings, Boolean)
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
  NameDescription
Public propertyDictionaries
Gets the dictionary repository.
Public propertyEvents
Gets the event hub for subscribing to events.
Public propertyIndexInfo
Gets the basic information on the index.
Public propertyIndexSettings
Gets the index setting.
Public propertyRepository
Gets the index repository object if the index is contained in it.
Methods
  NameDescription
Public methodCode exampleAdd(String)
Performs indexing operation. Adds a file or folder by an absolute or relative path. Documents from all subfolders will be indexed.
Public methodCode exampleAdd(String)
Performs indexing operation. Adds files or folders by an absolute or relative path. Documents from all subfolders will be indexed.
Public methodCode exampleAdd(String, IndexingOptions)
Performs indexing operation. Adds a file or folder by an absolute or relative path. Documents from all subfolders will be indexed.
Public methodCode exampleAdd(String, IndexingOptions)
Performs indexing operation. Adds files or folders by an absolute or relative path. Documents from all subfolders will be indexed.
Public methodCode exampleDelete
Deletes indexed files or folders from the index. Then updates the index without deleted paths.
Public methodDispose
Releases all resources used by the Index.
Public methodEquals (Inherited from Object.)
Protected methodFinalize
Finalizes an instance of the Index class.
(Overrides ObjectFinalize.)
Public methodCode exampleGetDocumentText(DocumentInfo, OutputAdapter)
Generates HTML formatted text for indexed document and transfers it through the output adapter.
Public methodGetDocumentText(DocumentInfo, OutputAdapter, TextOptions)
Generates HTML formatted text for indexed document and transfers it through the output adapter.
Public methodGetHashCode (Inherited from Object.)
Public methodCode exampleGetIndexedDocumentItems
Gets an array of a document items.
Public methodCode exampleGetIndexedDocuments
Gets an array of all indexed documents.
Public methodGetIndexedPaths
Gets an array of indexed paths - documents or folders.
Public methodCode exampleGetIndexingReports
Gets the reports on indexing operations.
Public methodCode exampleGetSearchReports
Gets the reports on search operations.
Public methodGetType (Inherited from Object.)
Public methodCode exampleHighlight(FoundDocument, Highlighter)
Generates HTML formatted text with highlighted found terms.
Public methodCode exampleHighlight(FoundDocument, Highlighter, HighlightOptions)
Generates HTML formatted text with highlighted found terms.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleMerge(Index, MergeOptions)
Merges the specified index into the current index. Note that the other index will not be changed.
Public methodCode exampleMerge(IndexRepository, MergeOptions)
Merges indexes from the specified index repository into the current index. Note that indexes in the repository will not be changed.
Public methodCode exampleOptimize
Minimizes the number of index segments by merging them one with another. This operation improves search performance.
Public methodCode exampleOptimize(MergeOptions)
Minimizes the number of index segments by merging them one with another. This operation improves search performance.
Public methodCode exampleSearch(String)
Searches in index.
Public methodCode exampleSearch(SearchQuery)
Searches in index.
Public methodCode exampleSearch(String, SearchOptions)
Searches in index.
Public methodCode exampleSearch(SearchQuery, SearchOptions)
Searches in index.
Public methodCode exampleSearchNext(ChunkSearchToken)
Continues the chunk search started with method Search.
Public methodCode exampleSearchNext(ChunkSearchToken, Cancellation)
Continues the chunk search started with method Search.
Public methodToString (Inherited from Object.)
Public methodCode exampleUpdate
Re-indexes documents that have been changed or deleted since last update. Adds new files that have been added to the indexed folders.
Public methodCode exampleUpdate(UpdateOptions)
Re-indexes documents that have been changed or deleted since last update. Adds new files that have been added to the indexed folders.
Examples
The example demonstrates a typical usage of the class.
C#
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