Managing dictionaries in network

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Search MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-search -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-search/search-net-mcp:latest
Folders, licensing and more →

To obtain a dictionary from a shard of a search network node, use the getDictionary method of the Indexer class. The first parameter of the getDictionary method is the type of the required dictionary, and the second parameter is the index of the shard in the network. The method returns an object of type DictionaryBase, which must be cast to the required dictionary type. In the Indexer class there are also methods that immediately return the desired dictionary type without casting the type and without specifying the type in the parameters.

You can then perform all operations on the dictionary object that are valid for a dictionary in a single index. For information about working with dictionaries, see articles Managing Dictionaries.

And after setting up the dictionary, you need to return the dictionary object back to the shard using the setDictionary method of the Indexer class, specifying the index of the desired shard. Alternatively, you can set the dictionary object to all shards by the setDictionary method with one parameter without specifying the shard index.

The following code example demonstrates working with dictionaries on the search network.

System.out.println("Adding synonyms");

Indexer indexer = node.getIndexer();

int[] indices = node.getShardIndices();
SynonymDictionary dictionary = indexer.getSynonymDictionary(indices[0]);

if (clearBeforeAdding) {
    dictionary.clear();
}
dictionary.addRange(new String[][] { group });

indexer.setDictionary(dictionary);

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.