GroupDocs.Search for .NET 23.11 Release Notes

Major Features

There are the following features, enhancements, and fixes in this release:

  • Implement a search on the search network using a search query in text form

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
SEARCHNET-2988Implement a search on the search network using a search query in text formEnhancement

Public API and Backward Incompatible Changes

Implement a search on the search network using a search query in text form

This enhancement to the search network adds support for search queries in text form, in addition to the already supported queries in object form.

Public API changes

Method GroupDocs.Search.Scaling.Results.NetworkSearchResult SearchFirst(System.String, GroupDocs.Search.Options.SearchOptions) has been added to GroupDocs.Search.Scaling.Searcher class.

Use cases

The following example demonstrates how to search in the distributed index on the main node with query in text form.

C#

private static void SearchInIndex(
    SearchNetworkNode node,
    string query)
{
    Console.WriteLine("Search first for: " + query);
    Searcher searcher = node.Searcher;
    SearchOptions options = new SearchOptions();
    options.IsChunkSearch = true;
    int hits = 0;
    List<NetworkFoundDocument> docs = new List<NetworkFoundDocument>();

    NetworkSearchResult result = searcher.SearchFirst(query, options);

    AddDocsFromResult(docs, result);
    hits += result.OccurrenceCount;
    TraceResult(result);

    while (result.NextChunkSearchToken != null)
    {
        Console.WriteLine("Search next");

        result = searcher.SearchNext(result.NextChunkSearchToken);

        AddDocsFromResult(docs, result);
        hits += result.OccurrenceCount;
        TraceResult(result);
    }
    Console.WriteLine("Total documents: " + docs.Count);
    Console.WriteLine("Total occurrences: " + hits);
}

private static void TraceResult(NetworkSearchResult result)
{
    Console.WriteLine("From node " + result.NodeIndex + ": occurrence count - " + result.OccurrenceCount);
}

private static void AddDocsFromResult(List<NetworkFoundDocument> docs, NetworkSearchResult result)
{
    for (int i = 0; i < result.DocumentCount; i++)
    {
        docs.Add(result.GetFoundDocument(i));
    }
}