Enterspeed.Query.Sdk 2.0.0

dotnet add package Enterspeed.Query.Sdk --version 2.0.0
                    
NuGet\Install-Package Enterspeed.Query.Sdk -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Enterspeed.Query.Sdk" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Enterspeed.Query.Sdk" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Enterspeed.Query.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Enterspeed.Query.Sdk --version 2.0.0
                    
#r "nuget: Enterspeed.Query.Sdk, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Enterspeed.Query.Sdk@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Enterspeed.Query.Sdk&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Enterspeed.Query.Sdk&version=2.0.0
                    
Install as a Cake Tool

Enterspeed Query .NET SDK · GitHub license NuGet version PRs Welcome

The Enterspeed Query .NET SDK empowers .NET developers to query and manage data from Enterspeed indexes with a modern, type-safe, and fluent API. It supports both simple and advanced scenarios, making it easy to integrate Enterspeed into your applications.

Key Features:

  • Typed query builders for model-driven, type-safe queries
  • Fluent API for intuitive query construction
  • Advanced filtering, sorting, pagination, and facets
  • Strongly typed responses for reliable data handling
  • Easy integration with .NET dependency injection

Installation

With .NET CLI:

dotnet add package Enterspeed.Query.Sdk --version <version>

With Package Manager:

Install-Package Enterspeed.Query.Sdk -Version <version>

Getting Started

Register Services

Add the Enterspeed query service to your DI container:

using IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((_, services) =>
        services.AddEnterspeedQueryService())
    .Build();

Using the Fluent Query Builders

The SDK provides a fluent QueryBuilder API for constructing queries in a type-safe, intuitive way. When using generics, filters, sorting, and facets are aligned with your model’s properties—property names are automatically camelCased (e.g., IsActive becomes isActive), unless a [JsonPropertyName] attribute is present, in which case its value is used. A non-generic approach is also available if you prefer not to use strong typing.

Example: Typed Query Builder (Full Flow)

var request = new QueryBuilder()
    .AddQuery<Movie>("key", "indexName", builder => builder 
      .WithPagination(0, 25)
      .SortBy(x => x.UpdatedAt, SortOrder.Desc)
      .Where(f => f
          .Equals(x => x.IsActive, true)
          .Or(o => o
              .Equals(x => x.IsGlobal, true)
              .In(x => x.Category, "selected category 1", "selected category 2"))
      )
      .WithFacet("tags", name: "Tags", size: 3)
      .WithFacet("category", name: "Category", size: 10)
      .WithAliases("blogPostTile", "blogPostDetail"))
    .Build();

var response = await _enterspeedQueryService.Query(
    "environment-******-****-****-****-**********",
    request,
    CancellationToken.None);

var movieList = response.Get<Movie>("key");

if (movieList is ISuccess<List<Movie>> success)
{
    success.Result.ForEach(movie =>
    {
        Console.WriteLine($"Title: {movie.Title}, Release Date: {movie.ReleaseDate}");
    });
}

if (movieList is IFailure failure)
{
    Console.WriteLine($"Query failed: {failure.ErrorMessage}");
}

public record Movie
{
    [JsonPropertyName("_updatedAt")]
    public DateTime UpdatedAt { get; init; }
    public bool IsActive { get; init; }
    public bool IsGlobal { get; init; }
    public string Category { get; init; }
    public string Title { get; init; }
    public DateTime ReleaseDate { get; init; }
}

See the Example project for more advanced usage and scenarios, including Web API integration and direct object construction.

Using the Non-Typed Fluent Query Builder

The non-generic QueryBuilder allows you to build queries without strong typing:

var query = new QueryBuilder()
    .AddQuery("key", "indexName", builder => builder
      .WithPagination(0, 10)
      .SortBy("_updatedAt", SortOrder.Desc)
      .Where(f => f.Equals("isActive", true)))
    .Build();

var response = await _enterspeedQueryService.Query(
    "environment-******-****-****-****-**********", 
    "blogIndex", 
    query);

Lambda-Based Filtering

The fluent API supports lambda-based filters that automatically combine multiple conditions. Multiple Where() calls are implicitly ANDed together, and the first filter is always an AND group by default.

// Single filter
var query = new QueryBuilder()
    .AddQuery("key", "indexName", builder => builder
        .Where(f => f.Equals("status", "active")))
    .Build();

// Multiple conditions (AND)
var query = new QueryBuilder()
    .Where(f => f
        .Equals("status", "active")
        .GreaterThan("age", 18)
        .LessThan("age", 65))
    .Build();

Available Filter Operators

Comparison Operators:

  • .Equals(field, value, caseInsensitive: bool = false) - Equality comparison
  • .NotEquals(field, value, caseInsensitive: bool = false) - Inequality comparison
  • .GreaterThan(field, value) - Greater than
  • .GreaterThanOrEquals(field, value) - Greater than or equal
  • .LessThan(field, value) - Less than
  • .LessThanOrEquals(field, value) - Less than or equal

String Operators:

  • .Contains(field, pattern, caseInsensitive: bool = false) - Pattern matching (use * wildcards)

Collection Operators:

  • .In(field, ...values) - Value in list

Examples:

// Case-insensitive search
var query = new QueryBuilder()
    .AddQuery("key", "indexName", builder => builder
    .Where(f => f.Equals("title", "hoodie", caseInsensitive: true)))
    .Build();

// Pattern matching
var query = new QueryBuilder()
    .AddQuery("key", "indexName", builder => builder
    .Where(f => f.Contains("description", "*premium*")))
    .Build();

// Value in list
var query = new QueryBuilder()
    .AddQuery("key", "indexName", builder => builder
    .Where(f => f.In("category", "electronics", "computers", "phones")))
    .Build();

// Typed usage
var query = new QueryBuilder()
    .AddQuery<Movie>("key", "indexName", builder => builder
        .Where(f => f.In(x => x.Category, "electronics", "computers", "phones")))
    .Build();

Nested Logical Grouping (OR/AND)

Create complex nested filter logic with OR and AND groups. Multiple Where() calls are implicitly ANDed.

var query = new QueryBuilder()
    .Where(f => f
        .Equals("status", "active")
        .Or(o => o
            .Equals("type", "A")
            .Equals("type", "B"))
        .And(a => a
            .GreaterThan("score", 50)
            .LessThan("score", 100)))
    .Build();

For more advanced scenarios, such as multi-query, direct object construction, and advanced logical grouping, see the Example project README.

Contributing

Pull requests are very welcome.
Please fork this repository and make a PR when you are ready.

Otherwise you are welcome to open an Issue in our issue tracker.

License

Enterspeed .NET SDK is MIT licensed

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 483 3/5/2026
1.1.0 229 1/6/2026
1.0.0 566 11/5/2025
1.0.0-alpha.1.0.0.0 178 11/4/2025