How to Run Examples

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Search MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-search -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-search/search-net-mcp:latest
Folders, licensing and more →

Build project from scratch

  • Open Visual Studio and go to File -> New -> Project.
  • Select appropriate project type - Console App, ASP.NET Web Application etc.
  • Install GroupDocs.Search for .NET from Nuget or official GroupDocs website following this guide.
  • Code your first application with GroupDocs.Search for .NET like this:

C#

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\"; // NOTE: Put here actual path for your documents
string query = "Einstein";

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

SearchResult result = index.Search(query); // Searching in index
foreach (FoundDocument document in result)
{
    Console.WriteLine(document.DocumentInfo.FilePath);
}
  • Build and Run your project.
  • List of found documents will appear in the console.
Note
In the evaluation mode, only the first 10 found documents can be retrieved: since version 26.11, an enumeration of a search result with foreach throws LicenseRestrictionException after the first 10 documents, as the GetFoundDocument method does for a document number of 10 or greater. See Evaluation limitations and licensing.

Download examples from GitHub

The complete examples package of GroupDocs.Search is hosted on GitHub. You can either download the ZIP file from here or clone the repository using your favorite Git client.

In case you download the ZIP file, extract the folders on your local disk. The extracted files and folders will look like following image:

In extracted files and folders, you can find the following solution file:

  • CSharp solution file

Open the solution in a version of Visual Studio that supports the target framework of the examples project (see System requirements). The Data folder contains all the sample document files used in the examples.

To run the examples, open the solution file in Visual Studio and build the project. To add missing references for GroupDocs.Search see Installation. All the functions are called from Program.cs. Un-comment the function you want to run and comment the rest.

Contribute

If you would like to add or improve an example, we encourage you to contribute to the project. All examples in this repository are open source and can be freely used in your own applications.

To contribute, you can fork the repository, edit the code and create a pull request. We will review the changes and include it in the repository if found helpful.