Klororf.AzSearchLinq 0.3.0-alpha

This is a prerelease version of Klororf.AzSearchLinq.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Klororf.AzSearchLinq --version 0.3.0-alpha                
NuGet\Install-Package Klororf.AzSearchLinq -Version 0.3.0-alpha                
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="Klororf.AzSearchLinq" Version="0.3.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Klororf.AzSearchLinq --version 0.3.0-alpha                
#r "nuget: Klororf.AzSearchLinq, 0.3.0-alpha"                
#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.
// Install Klororf.AzSearchLinq as a Cake Addin
#addin nuget:?package=Klororf.AzSearchLinq&version=0.3.0-alpha&prerelease

// Install Klororf.AzSearchLinq as a Cake Tool
#tool nuget:?package=Klororf.AzSearchLinq&version=0.3.0-alpha&prerelease                

AzSearchLinq

AzSearchLinq is a .Net package for simplify the queries to Azure Cognitive Search

Options avaibles in 0.3.0

Where

  • Filter with conditional operators (==,!=...)
  • Filter with string operatos (StartsWith,EndsWith,Contains)
  • use search.in method
  • filter with lambdas for complex types Select
  • Get the results and transform to other types

Usage

SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.Where<Product>(x =>x.ProductName != "Mr").Select(x=>x.Product);

Also you can concatenate multiple where

SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.Where<Product>(x =>x.ProductName != "Mr")
                    .And(x=>x.Price == 20)
                    .Search();
/// produces ProductName ne 'Mr' and Price eq 20

SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.Where<Product>(x =>x.ProductName != "Mr")
                    .Or(x=>x.Price == 20)
                    .Search();
/// produces ProductName ne 'Mr' or Price eq 20

Use logical operators

SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.Where<Product>(x =>x.ProductName != "Mr" && x.Price >10)
                    .And(x=>x.Price == 20)
                    .Search();

Use string methods for search


/// is highly recomended set a custom analyzer for search
SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.Where<Product>(x =>x.Description.StartsWith("Blu"))
                    .Search();

/// Produces search.ismatch('Blu*','Description')

Filter by the properties values

SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
var res = srchclient.SubWhere<Product,Color>(x =>x.Colors,x=>x.Hex="anything")
                    .Search();

/// Produces Colors/any(x: x/Hex eq 'anything')
Product Compatible and additional computed target framework versions.
.NET 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. 
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
0.7.0 76 5/21/2024
0.6.1 84 5/20/2024
0.6.0 82 5/10/2024
0.5.0-prerelease 70 5/10/2024
0.4.0-alpha 84 5/7/2024
0.3.0-alpha 80 4/30/2024
0.2.1-alpha 80 4/25/2024
0.2.0.3-alpha 84 4/16/2024
0.2.0.2-alpha 88 4/14/2024
0.2.0.1-alpha 76 4/12/2024
0.1.1-alpha 70 3/29/2024
0.1.0-alpha 73 3/27/2024