Use new matcher in http-ui

This commit is contained in:
ManyTheFish 2022-03-30 10:50:23 +02:00
parent 734d0899d3
commit 29c5f76d7f
3 changed files with 26 additions and 29 deletions

View file

@ -36,7 +36,9 @@ pub use self::heed_codec::{
RoaringBitmapLenCodec, StrBEU32Codec, StrStrU8Codec,
};
pub use self::index::Index;
pub use self::search::{FacetDistribution, Filter, MatchingWords, Search, SearchResult};
pub use self::search::{
FacetDistribution, Filter, MatcherBuilder, MatchingWords, Search, SearchResult,
};
pub type Result<T> = std::result::Result<T, error::Error>;

View file

@ -34,6 +34,16 @@ impl MatcherBuilder {
}
}
pub fn from_matching_words(matching_words: MatchingWords) -> Self {
Self {
matching_words,
crop_size: DEFAULT_CROP_SIZE,
crop_marker: None,
highlight_prefix: None,
highlight_suffix: None,
}
}
pub fn crop_size(&mut self, word_count: usize) -> &Self {
self.crop_size = word_count;
self