Advanced Document Search & Indexing .NET API



GroupDocs.Search for .NET is a powerful full-text search API that allows you to search through over 70 document formats in your applications. To make it possible to search instantly across thousands of documents, they must be added to the index.
- No additional software is required to search through documents of supported formats.
- Great variety of indexing and search options are provided to meet any requirements.
- Wide selection of full-text search types is available in text or object form queries.
- Externally pluggable text recognition in images and built-in reverse image search are supported.
- High indexing and search performance is achieved by unique algorithms and data structures, optimizations and multi-threaded execution.
- Various ways of visualizing search results in the text of documents are supported.
- Index scaling and load balancing are provided out of the box.
Supported Document Formats
https://docs.groupdocs.com/search/net/supported-document-formats/
Supported Features
Supported Search Types
Getting Started
1. Create an index
First of all, you need to create an index.
Documents will be processed and added to the index in a special format that provides very high search speed.
The following example shows how to create an index on disk.
string indexFolder = @"c:/MyIndex/";
Index index = new Index(indexFolder);
2. Add files to the index
Once the index is created, you can add documents to it that you want to search.
Adding documents to the index takes some time to convert the data into a searchable format.
The following example shows how to perform indexing synchronously.
string documentsFolder = @"c:/MyDocuments/";
index.Add(documentsFolder);
3. Search in the index
After indexing your documents, you can search the index.
The example below shows how to perform simple search in the index.
string query = "Einstein";
SearchResult result = index.Search(query);
4. Highlight search results
Search results can be seen highlighted in the text of the entire document or in fragments of text.
The following example shows how to highlight search results in the text of an entire document in HTML format.
if (result.DocumentCount > 0)
{
FoundDocument document = result.GetFoundDocument(0);
OutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, @"c:\Highlighted.html");
DocumentHighlighter highlighter = new DocumentHighlighter(outputAdapter);
index.Highlight(document, highlighter);
}
Fuzzy search
Below is a complete example code for a fuzzy search with an acceptable number of differences of 2 characters.
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
string query = "Deoxyribonucleic";
Index index = new Index(indexFolder);
index.Add(documentsFolder);
SearchOptions options = new SearchOptions();
options.FuzzySearch.Enabled = true;
options.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(2);
SearchResult result = index.Search(query, options);
Search for different word forms
The following listing shows a complete code example for searching for different word forms in the index.
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
Index index = new Index(indexFolder);
index.Add(documentsFolder);
SearchOptions options = new SearchOptions();
options.UseWordFormsSearch = true;
SearchResult result = index.Search("relative", options);
Reverse image search
The following code example demonstrates all stages of the reverse image search.
string indexFolder = @"c:\MyIndex";
string documentFolder = @"c:\MyDocuments";
Index index = new Index(indexFolder);
IndexingOptions indexingOptions = new IndexingOptions();
indexingOptions.ImageIndexingOptions.EnabledForContainerItemImages = true;
indexingOptions.ImageIndexingOptions.EnabledForEmbeddedImages = true;
indexingOptions.ImageIndexingOptions.EnabledForSeparateImages = true;
index.Add(documentFolder, indexingOptions);
ImageSearchOptions imageSearchOptions = new ImageSearchOptions();
imageSearchOptions.HashDifferences = 10;
imageSearchOptions.MaxResultCount = 100;
imageSearchOptions.SearchDocumentFilter =
SearchDocumentFilter.CreateFileExtension(".zip", ".png", ".jpg");
SearchImage searchImage = SearchImage.Create(@"c:\MyDocuments\image.png");
ImageSearchResult result = index.Search(searchImage, imageSearchOptions);

Tags
Aspose
| GroupDocs
| Advanced Document Search
| Indexing API
| .NET Search Library
| Boolean Search
| Fuzzy Search
| Metadata Search
| Full-Text Search
| Field Search
| Regular Expressions Search
| Custom Search Ranking
| Indexing Optimization
| Distributed Search Network
| Reverse Image Search
| Search API
| .NET Document Search
| Document Indexing API
| GroupDocs.Search for .NET
| Text Search API
| Search Results Highlighting
| Document Metadata Search
| Snippets Extraction
| Wildcard Search
| Search API for .NET