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) {
|
for win in phrase.windows(winsize) {
|
||||||
// Get all the documents with the matching distance for each word pairs.
|
// Get all the documents with the matching distance for each word pairs.
|
||||||
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
|
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
|
||||||
for (offset, s1) in win.iter().enumerate().filter_map(|(index, word)| {
|
for (offset, s1) in win
|
||||||
word.as_ref().map(|word| (index, word))
|
.iter()
|
||||||
}) {
|
.enumerate()
|
||||||
for (dist, s2) in win.iter().skip(offset + 1).enumerate().filter_map(|(index, word)| {
|
.filter_map(|(index, word)| word.as_ref().map(|word| (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 {
|
if dist == 0 {
|
||||||
match ctx.word_pair_proximity_docids(s1, s2, 1)? {
|
match ctx.word_pair_proximity_docids(s1, s2, 1)? {
|
||||||
Some(m) => bitmaps.push(m),
|
Some(m) => bitmaps.push(m),
|
||||||
|
@ -589,11 +589,8 @@ fn create_matching_words(
|
|||||||
PrimitiveQueryPart::Phrase(words) => {
|
PrimitiveQueryPart::Phrase(words) => {
|
||||||
let ids: Vec<_> =
|
let ids: Vec<_> =
|
||||||
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
|
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
|
||||||
let words = words
|
let words =
|
||||||
.into_iter()
|
words.into_iter().flatten().map(|w| MatchingWord::new(w, 0, false)).collect();
|
||||||
.flatten()
|
|
||||||
.map(|w| MatchingWord::new(w, 0, false))
|
|
||||||
.collect();
|
|
||||||
matching_words.push((words, ids));
|
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(word_bytes);
|
||||||
key_buffer.extend_from_slice(&position.to_be_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