diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-17 14:37:46 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-17 14:59:43 +0200 |
commit | 056a0728c775e37460ed00791ad503e03a88f3d6 (patch) | |
tree | a7bcc714aa39dd4bfb6e64d4c9e7689487c2da9f /src/schema.rs |
Initial import
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/schema.rs b/src/schema.rs new file mode 100644 index 0000000..9a137eb --- /dev/null +++ b/src/schema.rs @@ -0,0 +1,16 @@ +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.build() +} |