Change default index precision to microseconds (#27)

This commit is contained in:
Ming
2025-01-29 12:48:44 -05:00
committed by Stu Hood
parent 0552dddeb9
commit 26d623c411
2 changed files with 3 additions and 3 deletions

View File

@@ -1441,7 +1441,7 @@ mod test {
fn test_json_field_possibly_a_date() {
test_parse_query_to_logical_ast_helper(
r#"json.date:"2019-10-12T07:20:50.52Z""#,
r#"(Term(field=14, type=Json, path=date, type=Date, 2019-10-12T07:20:50Z) "[(0, Term(field=14, type=Json, path=date, type=Str, "2019")), (1, Term(field=14, type=Json, path=date, type=Str, "10")), (2, Term(field=14, type=Json, path=date, type=Str, "12t07")), (3, Term(field=14, type=Json, path=date, type=Str, "20")), (4, Term(field=14, type=Json, path=date, type=Str, "50")), (5, Term(field=14, type=Json, path=date, type=Str, "52z"))]")"#,
r#"(Term(field=14, type=Json, path=date, type=Date, 2019-10-12T07:20:50.52Z) "[(0, Term(field=14, type=Json, path=date, type=Str, "2019")), (1, Term(field=14, type=Json, path=date, type=Str, "10")), (2, Term(field=14, type=Json, path=date, type=Str, "12t07")), (3, Term(field=14, type=Json, path=date, type=Str, "20")), (4, Term(field=14, type=Json, path=date, type=Str, "50")), (5, Term(field=14, type=Json, path=date, type=Str, "52z"))]")"#,
true,
);
}
@@ -1734,7 +1734,7 @@ mod test {
);
test_parse_query_to_logical_ast_helper(
r#"date:"1985-04-12T23:20:50.52Z""#,
r#"Term(field=9, type=Date, 1985-04-12T23:20:50Z)"#,
r#"Term(field=9, type=Date, 1985-04-12T23:20:50.52Z)"#,
true,
);
}

View File

@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use crate::schema::flags::{FastFlag, IndexedFlag, SchemaFlagList, StoredFlag};
/// The precision of the indexed date/time values in the inverted index.
pub const DATE_TIME_PRECISION_INDEXED: DateTimePrecision = DateTimePrecision::Seconds;
pub const DATE_TIME_PRECISION_INDEXED: DateTimePrecision = DateTimePrecision::Microseconds;
/// Defines how DateTime field should be handled by tantivy.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]