mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-26 12:09:57 +00:00
Elastic unbounded range query (#624)
* Tidy up fmt remove unneccessary -> Result<()> followed by run.unwrap() in a test * Adding support for elasticsearch-style unbounded queries Extend the UserInputBound to include Unbounded, so we can reuse formatting and internal query format * Still working on elastic-style range queries Fixes #498 Merge the elastic_range into range Reformat to make code easier to follow, use optional() macro to return Some * Fixed bugs Made the range parser insensitive to whitespace between the ":" and the range. Removed optional parsing of field. Added a unit test for the range parser. Derived PartialEq to compare the results of parsing as structs, instead of strings. Found a bug with that unit test - "*}" was parsed as an UserInputBound::Exclusive, instead of UserInputBound::Unbounded. Added an early detection-and-return for * in the original range parser * Correct failing test Assume that we will use "{*" for Unbounded ranges * Add a note in the changelog cargo-fmt * Moved parenthesis to a newline to make nested if-else more visible
This commit is contained in:
@@ -369,6 +369,7 @@ impl QueryParser {
|
||||
match *bound {
|
||||
UserInputBound::Inclusive(_) => Ok(Bound::Included(term)),
|
||||
UserInputBound::Exclusive(_) => Ok(Bound::Excluded(term)),
|
||||
UserInputBound::Unbounded => Ok(Bound::Unbounded),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user