Merge pull request #97 from Kerollmops/remove-hashbrown-stop-words

Remove the hashbrown dependency for library users
This commit is contained in:
Clément Renault 2019-02-03 17:31:08 +01:00 committed by GitHub
commit 0d2daf27f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 21 deletions

View File

@ -1,13 +1,13 @@
#[global_allocator] #[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use std::collections::{HashMap, HashSet};
use std::io::{self, BufRead, BufReader}; use std::io::{self, BufRead, BufReader};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::error::Error; use std::error::Error;
use std::borrow::Cow; use std::borrow::Cow;
use std::fs::File; use std::fs::File;
use hashbrown::{HashMap, HashSet};
use serde_derive::{Serialize, Deserialize}; use serde_derive::{Serialize, Deserialize};
use structopt::StructOpt; use structopt::StructOpt;

View File

@ -1,7 +1,7 @@
#[global_allocator] #[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use log::{error, info}; use std::collections::{HashMap, HashSet};
use std::error::Error; use std::error::Error;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fmt; use std::fmt;
@ -12,19 +12,15 @@ use std::path::{PathBuf, Path};
use std::sync::Arc; use std::sync::Arc;
use std::time::SystemTime; use std::time::SystemTime;
use hashbrown::{HashMap, HashSet}; use chashmap::{CHashMap, ReadGuard};
use chashmap::CHashMap;
use chashmap::ReadGuard;
use elapsed::measure_time; use elapsed::measure_time;
use meilidb::database::Database; use meilidb::database::{Database, UpdateBuilder};
use meilidb::database::UpdateBuilder; use meilidb::database::schema::{Schema, SchemaBuilder};
use meilidb::database::schema::Schema;
use meilidb::database::schema::SchemaBuilder;
use meilidb::tokenizer::DefaultBuilder; use meilidb::tokenizer::DefaultBuilder;
use serde_derive::Deserialize; use serde_derive::{Serialize, Deserialize};
use serde_derive::Serialize;
use structopt::StructOpt; use structopt::StructOpt;
use warp::{Rejection, Filter}; use warp::{Rejection, Filter};
use log::{error, info};
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
pub struct Opt { pub struct Opt {

View File

@ -189,17 +189,18 @@ impl Database {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use std::collections::HashSet;
use std::error::Error; use std::error::Error;
use serde_derive::{Serialize, Deserialize}; use serde_derive::{Serialize, Deserialize};
use hashbrown::HashSet;
use tempfile::tempdir; use tempfile::tempdir;
use crate::database::schema::{SchemaBuilder, STORED, INDEXED}; use crate::database::schema::{SchemaBuilder, STORED, INDEXED};
use crate::database::update::UpdateBuilder; use crate::database::update::UpdateBuilder;
use crate::tokenizer::DefaultBuilder; use crate::tokenizer::DefaultBuilder;
use super::*;
#[test] #[test]
fn ingest_one_update_file() -> Result<(), Box<Error>> { fn ingest_one_update_file() -> Result<(), Box<Error>> {
let dir = tempdir()?; let dir = tempdir()?;
@ -367,7 +368,7 @@ mod tests {
mod bench { mod bench {
extern crate test; extern crate test;
use super::*; use std::collections::HashSet;
use std::error::Error; use std::error::Error;
use std::iter::repeat_with; use std::iter::repeat_with;
use self::test::Bencher; use self::test::Bencher;
@ -377,12 +378,13 @@ mod bench {
use rand::{Rng, SeedableRng}; use rand::{Rng, SeedableRng};
use serde_derive::Serialize; use serde_derive::Serialize;
use rand::seq::SliceRandom; use rand::seq::SliceRandom;
use hashbrown::HashSet;
use crate::tokenizer::DefaultBuilder; use crate::tokenizer::DefaultBuilder;
use crate::database::update::UpdateBuilder; use crate::database::update::UpdateBuilder;
use crate::database::schema::*; use crate::database::schema::*;
use super::*;
fn random_sentences<R: Rng>(number: usize, rng: &mut R) -> String { fn random_sentences<R: Rng>(number: usize, rng: &mut R) -> String {
let mut words = String::new(); let mut words = String::new();

View File

@ -1,3 +1,8 @@
use std::collections::HashSet;
use serde::Serialize;
use serde::ser;
use crate::database::update::DocumentUpdate; use crate::database::update::DocumentUpdate;
use crate::database::serde::SerializerError; use crate::database::serde::SerializerError;
use crate::database::schema::SchemaAttr; use crate::database::schema::SchemaAttr;
@ -5,10 +10,6 @@ use crate::tokenizer::TokenizerBuilder;
use crate::tokenizer::Token; use crate::tokenizer::Token;
use crate::{DocumentId, DocIndex}; use crate::{DocumentId, DocIndex};
use hashbrown::HashSet;
use serde::Serialize;
use serde::ser;
pub struct IndexerSerializer<'a, B> { pub struct IndexerSerializer<'a, B> {
pub tokenizer_builder: &'a B, pub tokenizer_builder: &'a B,
pub update: &'a mut DocumentUpdate, pub update: &'a mut DocumentUpdate,

View File

@ -1,4 +1,5 @@
use hashbrown::HashSet; use std::collections::HashSet;
use serde::Serialize; use serde::Serialize;
use serde::ser; use serde::ser;

View File

@ -1,7 +1,7 @@
use std::collections::HashSet;
use std::path::PathBuf; use std::path::PathBuf;
use std::error::Error; use std::error::Error;
use hashbrown::HashSet;
use serde::Serialize; use serde::Serialize;
use crate::database::serde::serializer::Serializer; use crate::database::serde::serializer::Serializer;