IndexRepository

IndexRepository class

Represents a container for combining multiple indexes and performing common operations on them.

public class IndexRepository : IDisposable

Constructors

Name Description
IndexRepository() Initializes a new instance of the IndexRepository class.

Properties

Name Description
Events { get; } Gets the event hub for subscribing to events.
Indexes { get; } Gets the indexes contained in this IndexRepository.

Methods

Name Description
AddToRepository(Index) Adds an index to the index repository.
AddToRepository(string) Opens and adds an index to the index repository.
Create() Creates a new index in memory.
Create(IndexSettings) Creates a new index in memory.
Create(string) Creates a new index on disk. The index folder will be cleaned before the index creation.
Create(string, IndexSettings) Creates a new index on disk. The index folder will be cleaned before the index creation.
Dispose() Releases all resources used by the IndexRepository.
Search(SearchQuery) Searches in all indexes of the repository.
Search(string) Searches in all indexes of the repository.
Search(SearchQuery, SearchOptions) Searches in all indexes of the repository.
Search(string, SearchOptions) Searches in all indexes of the repository.
Update() Updates all indexes in the repository.
Update(UpdateOptions) Updates all indexes in the repository.

Remarks

Learn more

Examples

The example demonstrates a typical usage of the class.

string indexFolder1 = @"c:\MyIndex\";
string indexFolder2 = @"c:\MyIndex\";
string query = "Einstein";

IndexRepository repository = new IndexRepository();
repository.AddToRepository(indexFolder1); // Loading an existing index
repository.AddToRepository(indexFolder2); // Loading another existing index

SearchResult result = repository.Search(query); // Searching in indexes of the repository

See Also