mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 18:45:06 +08:00
Merge pull request #507 from meilisearch/fix-documents-fields-order-inference
Fix the inference of the documents searchable fields
This commit is contained in:
commit
1cb9f75026
@ -17,6 +17,7 @@ env_logger = "0.7.0"
|
|||||||
fst = { version = "0.3.5", default-features = false }
|
fst = { version = "0.3.5", default-features = false }
|
||||||
hashbrown = { version = "0.6.0", features = ["serde"] }
|
hashbrown = { version = "0.6.0", features = ["serde"] }
|
||||||
heed = "0.6.1"
|
heed = "0.6.1"
|
||||||
|
indexmap = { version = "1.2.0", features = ["serde-1"] }
|
||||||
intervaltree = "0.2.5"
|
intervaltree = "0.2.5"
|
||||||
itertools = "0.8.2"
|
itertools = "0.8.2"
|
||||||
levenshtein_automata = { version = "0.1.1", features = ["fst_automaton"] }
|
levenshtein_automata = { version = "0.1.1", features = ["fst_automaton"] }
|
||||||
@ -26,19 +27,18 @@ meilisearch-tokenizer = { path = "../meilisearch-tokenizer", version = "0.8.4" }
|
|||||||
meilisearch-types = { path = "../meilisearch-types", version = "0.8.4" }
|
meilisearch-types = { path = "../meilisearch-types", version = "0.8.4" }
|
||||||
once_cell = "1.2.0"
|
once_cell = "1.2.0"
|
||||||
ordered-float = { version = "1.0.2", features = ["serde"] }
|
ordered-float = { version = "1.0.2", features = ["serde"] }
|
||||||
|
regex = "1.3.1"
|
||||||
sdset = "0.3.6"
|
sdset = "0.3.6"
|
||||||
serde = { version = "1.0.101", features = ["derive"] }
|
serde = { version = "1.0.101", features = ["derive"] }
|
||||||
serde_json = "1.0.41"
|
serde_json = "1.0.41"
|
||||||
siphasher = "0.3.1"
|
siphasher = "0.3.1"
|
||||||
slice-group-by = "0.2.6"
|
slice-group-by = "0.2.6"
|
||||||
zerocopy = "0.2.8"
|
zerocopy = "0.2.8"
|
||||||
regex = "1.3.1"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.3"
|
assert_matches = "1.3"
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
csv = "1.0.7"
|
csv = "1.0.7"
|
||||||
indexmap = { version = "1.2.0", features = ["serde-1"] }
|
|
||||||
jemallocator = "0.3.2"
|
jemallocator = "0.3.2"
|
||||||
rustyline = { version = "5.0.0", default-features = false }
|
rustyline = { version = "5.0.0", default-features = false }
|
||||||
structopt = "0.3.2"
|
structopt = "0.3.2"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use fst::{set::OpBuilder, SetBuilder};
|
use fst::{set::OpBuilder, SetBuilder};
|
||||||
|
use indexmap::IndexMap;
|
||||||
use sdset::{duo::Union, SetOperation};
|
use sdset::{duo::Union, SetOperation};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ pub fn push_documents_addition<D: serde::Serialize>(
|
|||||||
pub fn apply_documents_addition<'a, 'b>(
|
pub fn apply_documents_addition<'a, 'b>(
|
||||||
writer: &'a mut heed::RwTxn<'b, MainT>,
|
writer: &'a mut heed::RwTxn<'b, MainT>,
|
||||||
index: &store::Index,
|
index: &store::Index,
|
||||||
addition: Vec<HashMap<String, serde_json::Value>>,
|
addition: Vec<IndexMap<String, serde_json::Value>>,
|
||||||
) -> MResult<()> {
|
) -> MResult<()> {
|
||||||
let mut documents_additions = HashMap::new();
|
let mut documents_additions = HashMap::new();
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ pub fn apply_documents_addition<'a, 'b>(
|
|||||||
pub fn apply_documents_partial_addition<'a, 'b>(
|
pub fn apply_documents_partial_addition<'a, 'b>(
|
||||||
writer: &'a mut heed::RwTxn<'b, MainT>,
|
writer: &'a mut heed::RwTxn<'b, MainT>,
|
||||||
index: &store::Index,
|
index: &store::Index,
|
||||||
addition: Vec<HashMap<String, serde_json::Value>>,
|
addition: Vec<IndexMap<String, serde_json::Value>>,
|
||||||
) -> MResult<()> {
|
) -> MResult<()> {
|
||||||
let mut documents_additions = HashMap::new();
|
let mut documents_additions = HashMap::new();
|
||||||
|
|
||||||
|
@ -13,15 +13,15 @@ pub use self::documents_deletion::{apply_documents_deletion, DocumentsDeletion};
|
|||||||
pub use self::settings_update::{apply_settings_update, push_settings_update};
|
pub use self::settings_update::{apply_settings_update, push_settings_update};
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use heed::Result as ZResult;
|
|
||||||
use log::debug;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use fst::{IntoStreamer, Streamer};
|
use fst::{IntoStreamer, Streamer};
|
||||||
|
use heed::Result as ZResult;
|
||||||
|
use indexmap::IndexMap;
|
||||||
|
use log::debug;
|
||||||
use sdset::Set;
|
use sdset::Set;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{store, DocumentId, MResult};
|
use crate::{store, DocumentId, MResult};
|
||||||
use crate::database::{MainT, UpdateT};
|
use crate::database::{MainT, UpdateT};
|
||||||
@ -48,14 +48,14 @@ impl Update {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn documents_addition(data: Vec<HashMap<String, serde_json::Value>>) -> Update {
|
fn documents_addition(data: Vec<IndexMap<String, serde_json::Value>>) -> Update {
|
||||||
Update {
|
Update {
|
||||||
data: UpdateData::DocumentsAddition(data),
|
data: UpdateData::DocumentsAddition(data),
|
||||||
enqueued_at: Utc::now(),
|
enqueued_at: Utc::now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn documents_partial(data: Vec<HashMap<String, serde_json::Value>>) -> Update {
|
fn documents_partial(data: Vec<IndexMap<String, serde_json::Value>>) -> Update {
|
||||||
Update {
|
Update {
|
||||||
data: UpdateData::DocumentsPartial(data),
|
data: UpdateData::DocumentsPartial(data),
|
||||||
enqueued_at: Utc::now(),
|
enqueued_at: Utc::now(),
|
||||||
@ -81,8 +81,8 @@ impl Update {
|
|||||||
pub enum UpdateData {
|
pub enum UpdateData {
|
||||||
ClearAll,
|
ClearAll,
|
||||||
Customs(Vec<u8>),
|
Customs(Vec<u8>),
|
||||||
DocumentsAddition(Vec<HashMap<String, serde_json::Value>>),
|
DocumentsAddition(Vec<IndexMap<String, serde_json::Value>>),
|
||||||
DocumentsPartial(Vec<HashMap<String, serde_json::Value>>),
|
DocumentsPartial(Vec<IndexMap<String, serde_json::Value>>),
|
||||||
DocumentsDeletion(Vec<DocumentId>),
|
DocumentsDeletion(Vec<DocumentId>),
|
||||||
Settings(SettingsUpdate)
|
Settings(SettingsUpdate)
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ pub async fn get_searchable(ctx: Request<Data>) -> SResult<Response> {
|
|||||||
|
|
||||||
let schema = index.main.schema(&reader)?;
|
let schema = index.main.schema(&reader)?;
|
||||||
|
|
||||||
let searchable_attributes: Option<HashSet<String>> =
|
let searchable_attributes: Option<Vec<String>> =
|
||||||
schema.map(|s| s.indexed_name().iter().map(|i| (*i).to_string()).collect());
|
schema.map(|s| s.indexed_name().iter().map(|i| (*i).to_string()).collect());
|
||||||
|
|
||||||
Ok(tide::Response::new(200)
|
Ok(tide::Response::new(200)
|
||||||
|
Loading…
Reference in New Issue
Block a user