Configuring search network

Configuring a search network involves creating a configuration using the Configurator class and the fluent interface.

The Configurator class has methods for configuring general index settings, as well as for configuring each individual network node.

The setIndexSettings method creates an instance of the IndexSettingsConfigurator class, which allows you to set the following settings for each index of the distributed search network:

To complete the configuration of index settings, you must call the completeIndexSettings method.

To configure individual search network nodes, use the addNode method, which returns an instance of the NodeConfigurator class.

The NodeConfigurator class allows you to set the following node parameters:

  • Set the required IP address and port number of the search network node (setTcpEndpoint method).
  • Declare the node as a receiver of log messages for all other network nodes (addLogSink method).
  • Add an indexing service, which is the input for all operations that change the contents of shards in network nodes (addIndexer method). This service must be presented on the network exactly once.
  • Add a search service, which is the input for all search queries to the network (addSearcher method).
  • Add an extraction service used to extract data from documents added to the search network (addExtractor method). Increasing the number of extraction services (one per network node) increases the performance of search network indexing.
  • Add a shard service used to store extracted data in a form suitable for searching on the network (addShard method). Increasing the number of shards (one for each network node) increases the performance of searching the network.

To complete the configuration of a network node, you must call the completeNode method.

Once the search network configuration is complete, you must call the completeConfiguration method, which will return an instance of the Configuration class.

An instance of the Configuration class can be saved to a file or stream in the XML format using the Save method, and subsequently can be loaded from the file or stream using the Load method.

The following code example shows how to create a search network configuration that describes four nodes.

String address = "";
Configuration configuration = new Configurator()
        .setTextStorageSettings(true, Compression.High)
        .setTcpEndpoint(address, basePort)
        .addIndexer(basePath + "Indexer0")
        .addSearcher(basePath + "Searcher0")
        .setTcpEndpoint(address, basePort + 1)
        .addShard(basePath + "Shard1")
        .addExtractor(basePath + "Extractor1")
        .setTcpEndpoint(address, basePort + 2)
        .addShard(basePath + "Shard2")
        .addExtractor(basePath + "Extractor2")
        .setTcpEndpoint(address, basePort + 3)
        .addShard(basePath + "Shard3")
        .addExtractor(basePath + "Extractor3")

More resources

GitHub examples

You may easily run the code from documentation articles and see the features in action in our GitHub examples:

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.