To obtain a list of indexed documents in a specific search network shard, call the GetIndexedDocuments method of the Searcher class. The method returns an array of NetworkDocumentInfo objects; each of them contains the information about the document (DocumentInfo property) and the index of the shard that contains it (ShardIndex property).
To obtain a list of shards of the search network, use the GetShardIndices method of the SearchNetworkNode class. To get the index of the node on which a shard is located, use the GetNodeIndex method.
It is also possible to get a list of nested items of an indexed container document. To do this, use the GetIndexedDocumentItems method of the Searcher class.
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 page; the slave nodes must be started beforehand.
C#
stringbasePath=@"c:\SearchNetwork\";intbasePort=49100;// Loading the search network configuration from a fileConfigurationconfiguration=Configuration.Load(basePath+"Configuration.xml");// Creating, configuring and starting the master node; the timeouts are specified in millisecondsSearchNetworkNodenode=SearchNetworkNode.CreateMasterNode(0,basePath+"Node0",newTcpSettings(basePort,3000,3000,3000,1000),newFileLogger(basePath+"Log.txt",4.0),configuration);node.ConfigureAllNodes();node.Start();
The following code example, which continues the previous one, demonstrates obtaining a list of documents indexed in the search network, as well as outputting the resulting data and the attributes of the documents to the console.