GroupDocs.Search for .NET 24.6 Release Notes

Major Features

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

  • Implement methods with more arguments for OR, AND queries

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
SEARCHNET-2556Implement methods with more arguments for OR, AND queriesEnhancement

Public API and Backward Incompatible Changes

Implement loading an index from disk into memory completely

This enhancement allows you to build boolean AND, OR queries from more than 2 subqueries at a time.

Public API changes

Method GroupDocs.Search.SearchQuery CreateAndQuery(GroupDocs.Search.SearchQuery[]) has been added to GroupDocs.Search.SearchQuery class.
Method GroupDocs.Search.SearchQuery CreateOrQuery(GroupDocs.Search.SearchQuery[]) has been added to GroupDocs.Search.SearchQuery class.

Use cases

The following example demonstrates how to build complex boolean AND, OR search queries in object form using new methods.

C#

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

// Creating an index in the specified folder
Index index = new Index(indexFolder);

// Indexing documents from the specified folder
index.Add(documentsFolder);

string word1 = "result";
string word2 = "test";
string word3 = "song";

// Build And query
SearchQuery queryAnd = SearchQuery.CreateAndQuery(
    SearchQuery.CreateWordQuery(word1),
    SearchQuery.CreateWordQuery(word2),
    SearchQuery.CreateWordQuery(word3));

// Build Or query
SearchQuery queryOr = SearchQuery.CreateOrQuery(
    SearchQuery.CreateWordQuery(word1),
    SearchQuery.CreateWordQuery(word2),
    SearchQuery.CreateWordQuery(word3));

// Search with And query
SearchResult result1 = index.Search(queryAnd);

// Search with Or query
SearchResult result2 = index.Search(queryOr);