Foundatio.Parsers.SqlQueries 7.17.12

Prefix Reserved
dotnet add package Foundatio.Parsers.SqlQueries --version 7.17.12                
NuGet\Install-Package Foundatio.Parsers.SqlQueries -Version 7.17.12                
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="Foundatio.Parsers.SqlQueries" Version="7.17.12" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Foundatio.Parsers.SqlQueries --version 7.17.12                
#r "nuget: Foundatio.Parsers.SqlQueries, 7.17.12"                
#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 Foundatio.Parsers.SqlQueries as a Cake Addin
#addin nuget:?package=Foundatio.Parsers.SqlQueries&version=7.17.12

// Install Foundatio.Parsers.SqlQueries as a Cake Tool
#tool nuget:?package=Foundatio.Parsers.SqlQueries&version=7.17.12                

FoundatioFoundatio

Build status NuGet Version feedz.io Discord

A lucene style query parser that is extensible and allows additional syntax features. Also includes an Elasticsearch query_string query replacement that greatly enhances its capabilities for dynamic queries.

Getting Started (Development)

This package can be installed via the NuGet package manager. If you need help, please contact us via in-app support or open an issue. We’re always here to help if you have any questions!

  1. You will need to have Visual Studio Code installed.
  2. Open the Foundatio.Parsers.sln Visual Studio solution file.

Using LuceneQueryParser

Below is a small sampling of the things you can accomplish with LuceneQueryParser, so check it out! We use this library extensively in Exceptionless!

In the sample below we will parse a query and output it's structure using the DebugQueryVisitor and then generate the same exact query using the parse result.

using Foundatio.Parsers.LuceneQueries;
using Foundatio.Parsers.LuceneQueries.Visitors;

var parser = new LuceneQueryParser();
var result = parser.Parse("field:[1 TO 2]");
Debug.WriteLine(DebugQueryVisitor.Run(result));

Here is the parse result as shown from the DebugQueryVisitor

Group:
  Left - Term:
      TermMax: 2
      TermMin: 1
      MinInclusive: True
      MaxInclusive: True
      Field:
          Name: field

Finally, lets translate the parse result back into the original query.

var generatedQuery = GenerateQueryVisitor.Run(result);
System.Diagnostics.Debug.Assert(query == generatedQuery);

Query Syntax

Aggregation Syntax

Features

  • Lucene Query Syntax Parser
  • Field Aliases (static and dynamic)
  • Query Includes
    • Define stored queries that can be included inside other queries as macros that will be expanded
  • Validation
    • Validate query syntax
    • Restrict access to specific fields
    • Restrict the number of operations allowed
    • Restrict nesting depth
  • Elasticsearch
    • Elastic query string query replacement on steriods
    • Dynamic search and filter expressions
    • Dynamic aggregation expressions
      • Supported bucket aggregations: terms, geo grid, date histogram, numeric histogram
        • Bucket aggregations allow nesting other dynamic aggregations inside
      • Supported metric aggregations: min, max, avg, sum, stats, extended stats, cardinality, missing, percentiles
    • Dynamic sort expressions
    • Dynamic expressions can be exposed to end users to allow for custom searches, filters, sorting and aggregations
      • Enables allowing users to build custom views, charts and dashboards
      • Enables powerful APIs that allow users to do things you never thought of
    • Supports geo queries (proximity and radius)
      • mygeo:75044~75mi
        • Returns all documents that have a value in the mygeo field that is within a 75 mile radius of the 75044 zip code
    • Supports nested document mappings
    • Automatically resolves non-analyzed keyword sub-fields for sorting and aggregations
    • Aliases can be defined right on your NEST mappings
      • Supports both root and inner field name aliases

Thanks to all the people who have contributed

contributors

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
7.17.12 584 11/26/2024
7.17.11 516 9/27/2024
7.17.10 320 9/4/2024
7.17.9 219 8/31/2024
7.17.8 117 8/31/2024