mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
clippy: --fix
This commit is contained in:
parent
7c9935f96a
commit
cbf029f64c
@ -1,6 +1,6 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, Seek, SeekFrom};
|
use std::io::{self, Seek};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use grenad::{CompressionType, Sorter};
|
use grenad::{CompressionType, Sorter};
|
||||||
@ -66,7 +66,7 @@ pub fn sorter_into_reader(
|
|||||||
|
|
||||||
pub fn writer_into_reader(writer: grenad::Writer<File>) -> Result<grenad::Reader<File>> {
|
pub fn writer_into_reader(writer: grenad::Writer<File>) -> Result<grenad::Reader<File>> {
|
||||||
let mut file = writer.into_inner()?;
|
let mut file = writer.into_inner()?;
|
||||||
file.seek(SeekFrom::Start(0))?;
|
file.rewind()?;
|
||||||
grenad::Reader::new(file).map_err(Into::into)
|
grenad::Reader::new(file).map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
|||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Read, Seek, SeekFrom};
|
use std::io::{Read, Seek};
|
||||||
|
|
||||||
use fxhash::FxHashMap;
|
use fxhash::FxHashMap;
|
||||||
use heed::RoTxn;
|
use heed::RoTxn;
|
||||||
@ -510,7 +510,7 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
|
|
||||||
let mut original_documents = writer.into_inner()?;
|
let mut original_documents = writer.into_inner()?;
|
||||||
// We then extract the file and reset the seek to be able to read it again.
|
// We then extract the file and reset the seek to be able to read it again.
|
||||||
original_documents.seek(SeekFrom::Start(0))?;
|
original_documents.rewind()?;
|
||||||
|
|
||||||
// We create a final writer to write the new documents in order from the sorter.
|
// We create a final writer to write the new documents in order from the sorter.
|
||||||
let mut writer = create_writer(
|
let mut writer = create_writer(
|
||||||
@ -522,7 +522,7 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
// into this writer, extract the file and reset the seek to be able to read it again.
|
// into this writer, extract the file and reset the seek to be able to read it again.
|
||||||
self.flattened_sorter.write_into_stream_writer(&mut writer)?;
|
self.flattened_sorter.write_into_stream_writer(&mut writer)?;
|
||||||
let mut flattened_documents = writer.into_inner()?;
|
let mut flattened_documents = writer.into_inner()?;
|
||||||
flattened_documents.seek(SeekFrom::Start(0))?;
|
flattened_documents.rewind()?;
|
||||||
|
|
||||||
let mut new_external_documents_ids_builder: Vec<_> =
|
let mut new_external_documents_ids_builder: Vec<_> =
|
||||||
self.new_external_documents_ids_builder.into_iter().collect();
|
self.new_external_documents_ids_builder.into_iter().collect();
|
||||||
@ -650,10 +650,10 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
// Once we have written all the documents, we extract
|
// Once we have written all the documents, we extract
|
||||||
// the file and reset the seek to be able to read it again.
|
// the file and reset the seek to be able to read it again.
|
||||||
let mut original_documents = original_writer.into_inner()?;
|
let mut original_documents = original_writer.into_inner()?;
|
||||||
original_documents.seek(SeekFrom::Start(0))?;
|
original_documents.rewind()?;
|
||||||
|
|
||||||
let mut flattened_documents = flattened_writer.into_inner()?;
|
let mut flattened_documents = flattened_writer.into_inner()?;
|
||||||
flattened_documents.seek(SeekFrom::Start(0))?;
|
flattened_documents.rewind()?;
|
||||||
|
|
||||||
let output = TransformOutput {
|
let output = TransformOutput {
|
||||||
primary_key,
|
primary_key,
|
||||||
|
@ -7,15 +7,15 @@ fn set_stop_words(index: &Index, stop_words: &[&str]) {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let config = IndexerConfig::default();
|
let config = IndexerConfig::default();
|
||||||
|
|
||||||
let mut builder = Settings::new(&mut wtxn, &index, &config);
|
let mut builder = Settings::new(&mut wtxn, index, &config);
|
||||||
let stop_words = stop_words.into_iter().map(|s| s.to_string()).collect();
|
let stop_words = stop_words.iter().map(|s| s.to_string()).collect();
|
||||||
builder.set_stop_words(stop_words);
|
builder.set_stop_words(stop_words);
|
||||||
builder.execute(|_| (), || false).unwrap();
|
builder.execute(|_| (), || false).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_phrase_search_with_stop_words_given_criteria(criteria: &[Criterion]) {
|
fn test_phrase_search_with_stop_words_given_criteria(criteria: &[Criterion]) {
|
||||||
let index = super::setup_search_index_with_criteria(&criteria);
|
let index = super::setup_search_index_with_criteria(criteria);
|
||||||
|
|
||||||
// Add stop_words
|
// Add stop_words
|
||||||
set_stop_words(&index, &["a", "an", "the", "of"]);
|
set_stop_words(&index, &["a", "an", "the", "of"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user