mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
feat: Replace the linked-hash-map dependency by indexmap
This commit is contained in:
parent
f6ff79085e
commit
ee6a54fe4c
@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
bincode = "1.1.2"
|
||||
linked-hash-map = { version = "0.5.2", features = ["serde_impl"] }
|
||||
indexmap = { version = "1.1.0", features = ["serde-1"] }
|
||||
serde = { version = "1.0.91", features = ["derive"] }
|
||||
serde_json = { version = "1.0.39", features = ["preserve_order"] }
|
||||
toml = { version = "0.5.0", features = ["preserve_order"] }
|
||||
|
@ -6,7 +6,7 @@ use std::ops::BitOr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use linked_hash_map::LinkedHashMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
pub const DISPLAYED: SchemaProps = SchemaProps { displayed: true, indexed: false, ranked: false };
|
||||
pub const INDEXED: SchemaProps = SchemaProps { displayed: false, indexed: true, ranked: false };
|
||||
@ -53,14 +53,14 @@ impl BitOr for SchemaProps {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct SchemaBuilder {
|
||||
identifier: String,
|
||||
attributes: LinkedHashMap<String, SchemaProps>,
|
||||
attributes: IndexMap<String, SchemaProps>,
|
||||
}
|
||||
|
||||
impl SchemaBuilder {
|
||||
pub fn with_identifier<S: Into<String>>(name: S) -> SchemaBuilder {
|
||||
SchemaBuilder {
|
||||
identifier: name.into(),
|
||||
attributes: LinkedHashMap::new(),
|
||||
attributes: IndexMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,14 +147,14 @@ impl Schema {
|
||||
bincode::serialize_into(writer, &builder)
|
||||
}
|
||||
|
||||
fn attributes_ordered(&self) -> LinkedHashMap<String, SchemaProps> {
|
||||
fn attributes_ordered(&self) -> IndexMap<String, SchemaProps> {
|
||||
let mut ordered = BTreeMap::new();
|
||||
for (name, attr) in &self.inner.attrs {
|
||||
let (_, props) = self.inner.props[attr.0 as usize];
|
||||
ordered.insert(attr.0, (name, props));
|
||||
}
|
||||
|
||||
let mut attributes = LinkedHashMap::with_capacity(ordered.len());
|
||||
let mut attributes = IndexMap::with_capacity(ordered.len());
|
||||
for (_, (name, props)) in ordered {
|
||||
attributes.insert(name.clone(), props);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ csv = "1.0.7"
|
||||
diskus = "0.5.0"
|
||||
env_logger = "0.6.1"
|
||||
jemallocator = "0.1.9"
|
||||
linked-hash-map = "0.5.2"
|
||||
indexmap = { version = "1.1.0", features = ["serde-1"] }
|
||||
meilidb-core = { path = "../meilidb-core", version = "0.1.0" }
|
||||
quickcheck = "0.8.2"
|
||||
rand = "0.6.5"
|
||||
|
@ -9,7 +9,7 @@ use std::iter::FromIterator;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{Instant, Duration};
|
||||
|
||||
use linked_hash_map::LinkedHashMap;
|
||||
use indexmap::IndexMap;
|
||||
use rustyline::{Editor, Config};
|
||||
use structopt::StructOpt;
|
||||
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||
@ -39,7 +39,7 @@ pub struct Opt {
|
||||
pub char_context: usize,
|
||||
}
|
||||
|
||||
type Document = LinkedHashMap<String, String>;
|
||||
type Document = IndexMap<String, String>;
|
||||
|
||||
fn display_highlights(text: &str, ranges: &[usize]) -> io::Result<()> {
|
||||
let mut stdout = StandardStream::stdout(ColorChoice::Always);
|
||||
|
Loading…
Reference in New Issue
Block a user