GroupDocs.Search for .NET 18.5 Release Notes

Major Features

There are 3 enhancements in this regular monthly release:

  • Implement searching by parts
  • Implement ability to specify the number of searching threads
  • Add SearchingTime field to SearchResults

All Changes

KeySummaryCategory
SEARCHNET-1207Implement searching by partsEnhancement
SEARCHNET-1502Implement ability to specify the number of searching threadsEnhancement
SEARCHNET-1551Add SearchingTime field to SearchResultsEnhancement

Public API and Backward Incompatible Changes

Implement searching by parts

Description

This enhancement allows a user to run searching by parts (chunks). In huge indexes for terabytes of documents the search executes not immediately and can take some time. Searching by parts (chunks) makes it possible to get part of results much faster.

Public API changes

Class ChunkSearchToken has been added to GroupDocs.Search namespace.
Property ChunkSearchToken NextChunkSearchToken has been added to GroupDocs.Search.SearchResults class.
Property bool IsChunkSearch has been added to GroupDocs.Search.SearchParameters class.
Method Search(GroupDocs.Search.Searching.ChunkSearchToken) has been added to GroupDocs.Search.Index class.
Method GroupDocs.Search.Index.Search(GroupDocs.Search.Searching.ChunkSearchToken,GroupDocs.Search.Cancellation) has been added to GroupDocs.Search.Index class.

Usecases

This example shows how to perform the search of all chunks consistently:

C#

string indexFolder = "c:\\MyIndex\\";
string documentFolder1 = "c:\\MyDocuments1\\";
string documentFolder2 = "c:\\MyDocuments2\\";
string documentFolder3 = "c:\\MyDocuments3\\";
string query = "query";

Index index = new Index(indexFolder, true);

index1.AddToIndex(documentFolder1);
index1.AddToIndex(documentFolder2);
index1.AddToIndex(documentFolder3);

SearchParameters sp = new SearchParameters();
sp.IsChunkSearch = true;

SearchResults result = index.Search("query", sp);
int chankCount = 1;

while (result.NextChunkSearchToken != null)
{
    Console.WriteLine("Document count " + chankCount + " ('" + query + "'): " + result.Count);
    Console.WriteLine("Occurrence count " + chankCount + " ('" + query + "'): " + result.TotalHitCount);

    result = index.Search(result.NextChunkSearchToken);
    chankCount++;
}

Implement ability to specify the number of searching threads

Description

This enhancement allows user to specify number of searching threads.

Public API changes

Enum NumberOfThreads has been added to GroupDocs.Search namespace.
Property NumberOfThreads SearchingThreads has been added to GroupDocs.Search.SearchParameters class.
NumberOfThreads contains the following values:

  • Default
  • One
  • Two
  • Three
  • Four
  • Five
  • Six
  • Seven
  • Eight
Usecases

This example shows how to specify the number of searching threads for index:

C#

string indexFolder = "c:\\MyIndex\\";
string documentFolder = "c:\\MyDocuments\\";
string query = "query";

IndexingSettings settings = new IndexingSettings();
// specifying count of threads for searching
settings.SearchingThreads = NumberOfThreads.One;

Index index = new Index(indexFolder, true, settings);
index.AddToIndex(documentFolder);

// searching using specified above count of threads
SearchResults result = index.Search("query");

Add SearchingTime field to SearchResults

Description

This enhancement allows a user to see in search results the time when searching started and finished and total searching time.

Public API changes

Field DateTime StartTime has been added to GroupDocs.Search.SearchResults class.
Field DateTime EndTime has been added to GroupDocs.Search.SearchResults class.
Field TimeSpan SearchingTime has been added to GroupDocs.Search.SearchResults class.

Usecases

This example shows how to use fields with searching time:

C#

string indexFolder = "c:\\MyIndex\\";
string documentFolder = "c:\\MyDocuments\\";
string query = "query";

Index index = new Index(indexFolder, true);
index.AddToIndex(documentFolder);
SearchResults result = index.Search(query);

Console.WriteLine("Searching starts: {0}\nSearching ends: {1}\tSearching time: {2}", result.StartTime, result.EndTime, result.SearchingTime);