Skip to main content

Crate lucene_query_syntax

Crate lucene_query_syntax 

Source
Expand description

§lucene-query-syntax

Converts (a subset of) the Lucene query syntax to SQL queries.

Currently, it supports the following features:

  • Words: single words, like potato;
  • Phrases: quoted strings, such as "some stuff";
  • Named words or phrases: a word or phrase prefixed by <fieldname>:;
  • Groups: parenthesized queries of any sort;
  • Negation: negates the condition of any term by prefixing it with -;
  • Ranges: numeric ranges in the format {a TO b} or [a TO b], for exclusive and inclusive ranges, respectively.

§Purpose

This was developed for the purpose of being used internally in the main Troposphir, through lucene2sql.

Advanced Lucene features such as weights and fuzzy searches are unimplemented due to not being possible in naive SQL, and/or not used in the game’s search feature.

§Usage

The main entry point of this crate is parse, which gives you a Term that you can match on or visit.

§Example

let query = lucene_query_syntax::parse("name:\"Bob Ross\"")?;
println!("{query}");

Structs§

Boundary
The limit of a range.

Enums§

BoundaryKind
How to interpret the value of a boundary.
Operator
Describes how to combine the results of two terms.
Primitive
Value that is not composed of other values.
Term
An expression term.
Value
Anything that can be used as a search term value.

Functions§

parse
Parses a given Lucene query into a syntax tree.