mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 05:00:06 +01:00
Execute cargo fmt
This commit is contained in:
parent
3009981d31
commit
70465aa5ce
@ -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),
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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())?;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user