If there is any communication interruption in the search network, some operations may not complete correctly. To resolve such problems, call the Synchronize method of the Indexer class. The method synchronizes the list of indexed documents kept by the indexer with the documents in the shards.
Since version 26.11, the Synchronize method throws InvalidOperationException and sends nothing to the shards when the master node cannot read its list of the documents of a shard, for example because another program holds it: a synchronization with an incomplete list would delete documents from the shard. Call the method again when the list can be read.
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 how to synchronize search network nodes.