# Getting document text in network This page contains information about getting document text in the search network. To obtain the extracted text of indexed documents in the search network, the [GetDocumentText](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/getdocumenttext/) method of the [Searcher](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/) class is used. The first parameter of the [GetDocumentText](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/getdocumenttext/) method is a document represented by the [NetworkDocumentInfo](https://reference.groupdocs.com/search/net/groupdocs.search.scaling.results/networkdocumentinfo/) class. A list of all indexed documents in the search network can be obtained using the [GetIndexedDocuments](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/getindexeddocuments/) method of the [Searcher](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/) class. The second parameter of the [GetDocumentText](https://reference.groupdocs.com/search/net/groupdocs.search.scaling/searcher/getdocumenttext/) method is the result output adapter. In this operation, the same output adapter classes are used as those used in similar operations of a single index. For information about output adapters, see the [Output adapters]({{< ref "search/net/developer-guide/advanced-usage/searching/output-adapters.md" >}}) page. Since version 26.11, the errors that the index of the shard reports while it generates the text are reported by the [ErrorOccurred](https://reference.groupdocs.com/search/net/groupdocs.search.scaling.events/nodeeventhub/erroroccurred/) event of the master node: for example, a document that has been deleted from the shard after the list of documents was obtained gives no text, and the event reports "Document is not found." The examples on this page use the master node of a running search network. The following code creates and starts the master node as described on the [Search network deployment]({{< ref "search/net/developer-guide/advanced-usage/scaling/search-network-deployment.md" >}}) page; the slave nodes must be started beforehand. **C#** ```csharp string basePath = @"c:\SearchNetwork\"; int basePort = 49100; // Loading the search network configuration from a file Configuration configuration = Configuration.Load(basePath + "Configuration.xml"); // Creating, configuring and starting the master node; the timeouts are specified in milliseconds SearchNetworkNode node = SearchNetworkNode.CreateMasterNode( 0, basePath + "Node0", new TcpSettings(basePort, 3000, 3000, 3000, 1000), new FileLogger(basePath + "Log.txt", 4.0), configuration); node.ConfigureAllNodes(); node.Start(); ``` The following code example, which continues the previous one, demonstrates retrieving the text of a document indexed in the search network, as well as outputting the resulting data to the console. **C#** ```csharp string fileName = "Lorem ipsum.pdf"; // The name of the document to get the text of Searcher searcher = node.Searcher; List documents = new List(); int[] shardIndices = node.GetShardIndices(); for (int i = 0; i < shardIndices.Length; i++) { int shardIndex = shardIndices[i]; NetworkDocumentInfo[] infos = searcher.GetIndexedDocuments(shardIndex); documents.AddRange(infos); for (int j = 0; j < infos.Length; j++) { NetworkDocumentInfo info = infos[j]; NetworkDocumentInfo[] items = searcher.GetIndexedDocumentItems(info); documents.AddRange(items); } } for (int i = 0; i < documents.Count; i++) { NetworkDocumentInfo document = documents[i]; if (document.DocumentInfo.ToString().Contains(fileName)) { Console.WriteLine(); Console.WriteLine(document.DocumentInfo.ToString()); StringOutputAdapter outputAdapter = new StringOutputAdapter(OutputFormat.PlainText); searcher.GetDocumentText(document, outputAdapter); Console.WriteLine(outputAdapter.GetResult()); break; } } ``` ## More resources ### GitHub examples You may easily run the code from documentation articles and see the features in action in our GitHub examples: * [GroupDocs.Search for .NET examples](https://github.com/groupdocs-search/GroupDocs.Search-for-.NET) * [GroupDocs.Search for Java examples](https://github.com/groupdocs-search/GroupDocs.Search-for-Java) ### Free online document search App Along with full featured .NET library we provide simple, but powerful free Apps. You are welcome to search over your PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and more with our free online [Free Online Document Search App](https://products.groupdocs.app/search).