Feature/reader (#517)

Adding IndexReader to the API. Making it possible to watch for changes.

* Closes #500
This commit is contained in:
Paul Masurel
2019-03-20 08:39:22 +09:00
committed by GitHub
parent a934577168
commit 663dd89c05
63 changed files with 1354 additions and 654 deletions

View File

@@ -239,12 +239,13 @@ impl QueryParser {
let term = Term::from_field_i64(field, val);
Ok(vec![(0, term)])
}
FieldType::Date(_) => {
match chrono::DateTime::parse_from_rfc3339(phrase) {
Ok(x) => Ok(vec![(0, Term::from_field_date(field, &x.with_timezone(&chrono::Utc)))]),
Err(e) => Err(QueryParserError::DateFormatError(e))
}
}
FieldType::Date(_) => match chrono::DateTime::parse_from_rfc3339(phrase) {
Ok(x) => Ok(vec![(
0,
Term::from_field_date(field, &x.with_timezone(&chrono::Utc)),
)]),
Err(e) => Err(QueryParserError::DateFormatError(e)),
},
FieldType::U64(_) => {
let val: u64 = u64::from_str(phrase)?;
let term = Term::from_field_u64(field, val);
@@ -791,7 +792,9 @@ mod test {
query_parser.parse_query("date:18a"),
Err(QueryParserError::DateFormatError(_))
);
assert!(query_parser.parse_query("date:\"1985-04-12T23:20:50.52Z\"").is_ok());
assert!(query_parser
.parse_query("date:\"1985-04-12T23:20:50.52Z\"")
.is_ok());
}
#[test]