Search

Search(string)

Searches in all indexes of the repository.

public SearchResult Search(string query)
Parameter Type Description
query String The search query.

Return Value

The search result.

Examples

The example demonstrates how to perform search in index repository.

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

IndexRepository repository = new IndexRepository();
Index index = repository.Create(indexFolder); // Creating index
index.Add(documentsFolder); // Indexing documents

SearchResult result = repository.Search(query); // Searching

See Also


Search(string, SearchOptions)

Searches in all indexes of the repository.

public SearchResult Search(string query, SearchOptions options)
Parameter Type Description
query String The search query.
options SearchOptions The search options.

Return Value

The search result.

Examples

The example demonstrates how to perform search in index repository.

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

IndexRepository repository = new IndexRepository();
Index index = repository.Create(indexFolder); // Creating index
index.Add(documentsFolder); // Indexing documents

SearchOptions options = new SearchOptions();
options.UseCaseSensitiveSearch = true; // Setting flag of case sensitive search

SearchResult result = repository.Search(query, options); // Searching

See Also


Searches in all indexes of the repository.

public SearchResult Search(SearchQuery query)
Parameter Type Description
query SearchQuery The search query.

Return Value

The search result.

Examples

The example demonstrates how to perform search in index repository.

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

IndexRepository repository = new IndexRepository();
Index index = repository.Create(indexFolder); // Creating index
index.Add(documentsFolder); // Indexing documents

SearchQuery query = SearchQuery.CreateWordQuery("Einstein"); // Creating search query in object form

SearchResult result = repository.Search(query); // Searching

See Also


Search(SearchQuery, SearchOptions)

Searches in all indexes of the repository.

public SearchResult Search(SearchQuery query, SearchOptions options)
Parameter Type Description
query SearchQuery The search query.
options SearchOptions The search options.

Return Value

The search result.

Examples

The example demonstrates how to perform search in index repository.

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

IndexRepository repository = new IndexRepository();
Index index = repository.Create(indexFolder); // Creating index
index.Add(documentsFolder); // Indexing documents

SearchOptions options = new SearchOptions();
options.UseCaseSensitiveSearch = true; // Setting flag of case sensitive search

SearchQuery query = SearchQuery.CreateWordQuery("Einstein"); // Creating search query in object form

SearchResult result = repository.Search(query, options); // Searching

See Also