change index

This commit is contained in:
Nikita Galaiko 2023-03-17 14:40:55 +01:00
parent 781390be76
commit fa06ec611d

View File

@ -11,7 +11,7 @@ use std::{
}; };
use tantivy::{collector, directory::MmapDirectory, schema, IndexWriter}; use tantivy::{collector, directory::MmapDirectory, schema, IndexWriter};
const CURRENT_VERSION: u64 = 3; // should not decrease const CURRENT_VERSION: u64 = 4; // should not decrease
#[derive(Clone)] #[derive(Clone)]
struct MetaStorage { struct MetaStorage {
@ -286,7 +286,10 @@ fn index_delta(
ChangeTag::Insert => change.as_str(), ChangeTag::Insert => change.as_str(),
ChangeTag::Equal => None, ChangeTag::Equal => None,
}) })
.collect::<String>(); .map(|s| s.trim())
.filter(|s| !s.is_empty())
.collect::<Vec<&str>>()
.join(" ");
doc.add_text(index.schema().get_field("diff").unwrap(), changes); doc.add_text(index.schema().get_field("diff").unwrap(), changes);