Execute cargo fmt

This commit is contained in:
unvalley 2022-11-04 08:59:58 +09:00
parent 3009981d31
commit 70465aa5ce
3 changed files with 14 additions and 12 deletions

View File

@ -431,12 +431,17 @@ pub fn resolve_phrase(ctx: &dyn Context, phrase: &[Option<String>]) -> Result<Ro
for win in phrase.windows(winsize) {
// Get all the documents with the matching distance for each word pairs.
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
for (offset, s1) in win.iter().enumerate().filter_map(|(index, word)| {
word.as_ref().map(|word| (index, word))
}) {
for (dist, s2) in win.iter().skip(offset + 1).enumerate().filter_map(|(index, word)| {
word.as_ref().map(|word| (index, word))
}) {
for (offset, s1) in win
.iter()
.enumerate()
.filter_map(|(index, word)| word.as_ref().map(|word| (index, word)))
{
for (dist, s2) in win
.iter()
.skip(offset + 1)
.enumerate()
.filter_map(|(index, word)| word.as_ref().map(|word| (index, word)))
{
if dist == 0 {
match ctx.word_pair_proximity_docids(s1, s2, 1)? {
Some(m) => bitmaps.push(m),

View File

@ -589,11 +589,8 @@ fn create_matching_words(
PrimitiveQueryPart::Phrase(words) => {
let ids: Vec<_> =
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
let words = words
.into_iter()
.flatten()
.map(|w| MatchingWord::new(w, 0, false))
.collect();
let words =
words.into_iter().flatten().map(|w| MatchingWord::new(w, 0, false)).collect();
matching_words.push((words, ids));
}
}

View File

@ -41,7 +41,7 @@ pub fn extract_word_position_docids<R: io::Read + io::Seek>(
key_buffer.extend_from_slice(word_bytes);
key_buffer.extend_from_slice(&position.to_be_bytes());
word_position_docids_sorter.insert(&key_buffer,document_id.to_ne_bytes())?;
word_position_docids_sorter.insert(&key_buffer, document_id.to_ne_bytes())?;
}
}