summaryrefslogtreecommitdiffstats
path: root/src/schema.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-04-18 11:00:26 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-04-18 11:00:26 +0200
commit25af8a1197de6b3aecb1fd7273e573b05f8e0000 (patch)
tree4d4a3444a68f223ae434d7da9ab97012d43b6016 /src/schema.rs
parentdfc38880b32112f2dda6b6c55c6c55830b0c92e7 (diff)
Add more fields
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/schema.rs')
-rw-r--r--src/schema.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/schema.rs b/src/schema.rs
index 9a137eb..c051000 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -3,14 +3,21 @@ use tantivy::schema::*;
pub fn schema() -> Schema {
let mut schema_builder = Schema::builder();
- let body_options = TextOptions::default()
- .set_stored()
- .set_indexing_options(TextFieldIndexing::default()
- .set_tokenizer("default")
- .set_index_option(IndexRecordOption::WithFreqsAndPositions));
-
schema_builder.add_text_field("path", STRING | STORED);
schema_builder.add_text_field("ft", STRING | STORED);
- schema_builder.add_text_field("body", body_options );
+ schema_builder.add_u64_field("size", INDEXED | STORED);
+ schema_builder.add_i64_field("created", INDEXED | STORED);
+ schema_builder.add_i64_field("modified", INDEXED | STORED);
+ schema_builder.add_u64_field("indexed", INDEXED | STORED);
+
+ {
+ let body_options = TextOptions::default()
+ .set_stored()
+ .set_indexing_options(TextFieldIndexing::default()
+ .set_tokenizer("default")
+ .set_index_option(IndexRecordOption::WithFreqsAndPositions));
+ schema_builder.add_text_field("body", body_options);
+ }
+
schema_builder.build()
}