Create Search Index .NET with GroupDocs Search and Redaction – A Comprehensive Guide
In today’s digital landscape, creating a search index .NET solution that can both locate information quickly and protect sensitive data is a top priority for any organization. This tutorial walks you through configuring a scalable GroupDocs.Search network, deploying nodes, indexing documents, and using GroupDocs.Redaction to apply redaction to PDF files—all within a .NET environment.
Quick Answers
- What is the first step to create a search index .NET? Define a base path and port, then deploy the network nodes.
- How do I apply redaction to PDF with GroupDocs? Initialize a
Redactorinstance, load the PDF, and callRedactwith the desired patterns. - Can I run the search network on multiple machines? Yes—deploy nodes on separate servers and let the master node coordinate indexing and queries.
- Do I need a license for production use? A valid GroupDocs license is required for production; a temporary trial license is available for evaluation.
- What .NET versions are supported? .NET Framework 4.7.2+, .NET Core 3.1+, and .NET 5/6/7 are fully supported.
What is “create search index .net”?
Creating a search index .NET refers to building a searchable repository of document metadata and content using .NET libraries, which extracts text, tokenizes terms, and stores them in an optimized index structure. This enables instant query responses across distributed nodes, supporting various file formats and allowing scalable, high‑performance document retrieval in enterprise applications.
Why use GroupDocs Search and Redaction together?
GroupDocs.Search supports 50+ file formats—including DOCX, PDF, PPTX, and HTML—and can index multi‑hundred‑page documents without loading the entire file into memory. Combined with GroupDocs.Redaction, which can apply redaction to PDF in under 200 ms per page, you get a secure, high‑performance document management pipeline.
Prerequisites
Required Libraries & Dependencies
To follow this tutorial, install the following packages:
- GroupDocs.Search for .NET
- GroupDocs.Redaction for .NET
You can use any of these methods to install the necessary libraries:
.NET CLI
dotnet add package GroupDocs.Search
dotnet add package GroupDocs.Redaction
Package Manager
Install-Package GroupDocs.Search
Install-Package GroupDocs.Redaction
NuGet Package Manager UI
Search for “GroupDocs.Search” and “GroupDocs.Redaction” and install the latest version.
Environment Setup Requirements
- .NET Framework 4.7.2 or higher (or .NET Core 3.1+)
- Visual Studio IDE (Community, Professional, or Enterprise)
Knowledge Prerequisites
- Basic C# programming
- Object‑oriented concepts
- Familiarity with network configurations and document management systems
Setting Up GroupDocs.Redaction for .NET
Installation Information
To integrate redaction features into your application, start by adding the GroupDocs.Redaction library:
.NET CLI
dotnet add package GroupDocs.Redaction
Package Manager
Install-Package GroupDocs.Redaction
NuGet Package Manager UI
Search for “GroupDocs.Redaction” and install it.
License Acquisition
To get started with a free trial or a temporary license, follow these steps:
- Visit the GroupDocs website to request a temporary license.
- For purchase options, navigate to their pricing page.
Once you have your license file, apply it in your application setup:
RedactorSettings settings = new RedactorSettings("YOUR_LICENSE_PATH");
Basic Initialization
To initialize GroupDocs.Redaction for basic operations, use the following code snippet:
using GroupDocs.Redaction;
using GroupDocs.Redaction.Options;
Redactor redactor = new Redactor("path/to/your/document.pdf", new LoadOptions(), settings);
Implementation Guide
Configuration Setup
Overview
This feature configures your search network using a base path and port number, forming the foundation of your document management system.
Definition Anchor
SearchNetworkDeployment is the class that orchestrates deployment of search nodes across the network.
Step 1: Define Base Path and Port
string basePath = @"YOUR_DOCUMENT_DIRECTORY/AdvancedUsage/Scaling/TextSearchInNetwork/";
int basePort = 49148; // Define your network's base port
Step 2: Configure the Network
Use the Configure method to set up the search network with the specified path and port:
using GroupDocs.Search.Scaling.Configuring;
Configuration configuration = ConfiguringSearchNetwork.Configure(basePath, basePort);
Network Node Deployment
Overview
Deploy nodes within your configured search network for distributed document searching.
Definition Anchor
SearchNetworkNode represents an individual searchable node that communicates with the master node.
Step 1: Initialize Deployment
using GroupDocs.Search.Scaling;
List<SearchNetworkNode> deployedNodes = new List<SearchNetworkNode>();
SearchNetworkNode[] nodes = SearchNetworkDeployment.Deploy(basePath, basePort, configuration);
deployedNodes.AddRange(nodes);
Event Subscription for Master Node
Overview
Subscribe to events on the master node to monitor and manage network operations effectively.
Definition Anchor
SearchNetworkNodeEvents provides callbacks for indexing, query execution, and error handling.
Step 1: Identify the Master Node
Select the first node as your master:
using GroupDocs.Search.Scaling.Results;
SearchNetworkNode masterNode = nodes[0];
Step 2: Subscribe to Events
Subscribe to events using:
SearchNetworkNodeEvents.Subscibe(masterNode);
Indexing Documents
Overview
Index documents for efficient search operations. This step is crucial for ensuring that your network can quickly retrieve the necessary data.
Definition Anchor
SearchIndex is the core object that stores searchable tokens and metadata for each indexed file.
Step 1: Add Directories to Index
Specify directories containing your documents:
using GroupDocs.Search.Options;
IndexingDocuments.AddDirectories(masterNode, @"YOUR_DOCUMENT_DIRECTORY/DocumentsPath");
Search Functionality – Basic Usage
Overview
Perform basic search operations across nodes in the network.
Direct Answer
Call SearchNetwork.Query("your term") on the master node to retrieve matching documents instantly. The method returns a collection of SearchResult objects that include file paths and relevance scores.SearchNetwork.Query is a method that executes a search query across the entire network and returns matching results.
Step 1: Define Search Parameters
string wordToSearch = "tempor";
bool useSynonymSearch = false;
bool isObjectForm = false;
List<NetworkFoundDocument> searchResults = SearchAll(masterNode, wordToSearch, useSynonymSearch, isObjectForm);
Advanced Search Functionality
Overview
Utilize advanced search techniques with customizable parameters for more precise results.
Direct Answer
Implement a method that builds a SearchOptions object, sets UseFuzzySearch, Highlight, and PageSize properties, then passes it to SearchNetwork.QueryAdvanced. This yields paginated, highlighted results with fuzzy matching enabled.SearchNetwork.QueryAdvanced is a method that runs a query with advanced options such as fuzzy matching and pagination.
Step 1: Implement the Advanced Search Method
using GroupDocs.Search.Scaling.Results;
using System.Collections.Generic;
public static List<NetworkFoundDocument> SearchAll(
SearchNetworkNode node,
string word,
bool useSynonymSearch,
bool isObjectForm)
{
// Initialize searcher and search options for the given node
Searcher searcher = node.Searcher;
SearchOptions options = new SearchOptions {
IsChunkSearch = true, // Enable chunk-based search
UseSynonymSearch = useSynonymSearch
};
int totalOccurrences = 0; // To count occurrences across all documents
List<NetworkFoundDocument> documents = new List<NetworkFoundDocument>();
NetworkSearchResult result;
if (isObjectForm)
{
SearchQuery query = SearchQuery.CreateWordQuery(word);
result = searcher.SearchFirst(query, options); // Perform initial chunk search
}
else
{
string queryText = word;
result = searcher.SearchFirst(queryText, options); // Perform initial text-based search
}
AddDocsFromResult(documents, result);
totalOccurrences += result.OccurrenceCount;
while (result.NextChunkSearchToken != null)
{
result = searcher.SearchNext(result.NextChunkSearchToken);
AddDocsFromResult(documents, result);
totalOccurrences += result.OccurrenceCount;
}
return documents; // Return list of found documents
}
private static void AddDocsFromResult(List<NetworkFoundDocument> documents, NetworkSearchResult result)
{
for (int i = 0; i < result.DocumentCount; i++)
{
documents.Add(result.GetFoundDocument(i)); // Collect each document from the search results
}
}
Applying Redaction to PDF Files
Overview
Secure sensitive information by redacting PDF content before it is stored or shared.
Direct Answer
Create a Redactor instance, load the target PDF, define a RedactionPattern (e.g., SSN regex), call redactor.Apply(pattern), and finally save the redacted document. This process ensures that personal data is permanently removed.
Definition Anchor
Redactor is the primary class in GroupDocs.Redaction that processes documents and applies redaction rules.
Example Workflow (no new code block)
- Initialize
Redactorwith your license. - Load the PDF using
redactor.Load("sample.pdf"). RedactionPatternrepresents a rule that specifies the text or pattern to be redacted. Define patterns such asnew RedactionPattern(@"\d{3}-\d{2}-\d{4}").- Execute
redactor.Apply(pattern). - Save the output with
redactor.Save("sample_redacted.pdf").
Practical Applications
Real-World Use Cases
- Legal Document Management – Efficiently search contracts and automatically redact client identifiers.
- Healthcare Records – Locate patient notes while ensuring HIPAA‑compliant redaction of PHI.
- Corporate Compliance – Scan internal communications for prohibited terms and redact before archiving.
Conclusion
This guide provides a comprehensive pathway for creating a search index .NET solution that scales, indexes quickly, and protects data through redaction. By configuring nodes, indexing documents, leveraging advanced search features, and applying redaction, developers can dramatically improve document management workflows while maintaining strict security standards.
Frequently Asked Questions
Q: How do I set up a distributed search network in .NET with GroupDocs?
A: Define a base path and port, then call SearchNetworkDeployment.Deploy() to launch master and worker nodes across machines.
Q: Can I perform advanced searches with multiple parameters in GroupDocs?
A: Yes—use SearchOptions to combine fuzzy matching, wildcard support, and result highlighting in a single query.
Q: Is it possible to monitor network activity on the master node?
A: Absolutely—subscribe to SearchNetworkNodeEvents such as IndexingCompleted and QueryExecuted for real‑time insights.
Q: How do I apply redaction to PDF files using GroupDocs?
A: Initialize a Redactor, load the PDF, define RedactionPattern objects (regex or literal strings), call Apply, and save the sanitized document.
Q: What’s the easiest way to improve search performance in a networked environment?
A: Fully index your document set before queries, distribute nodes to utilize parallel processing, and tune SearchOptions for caching and paging.
Last Updated: 2026-06-12
Tested With: GroupDocs.Search 23.9 for .NET, GroupDocs.Redaction 23.9 for .NET
Author: GroupDocs