mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-29 16:24:26 +01:00
bump milli to 0.4.0
This commit is contained in:
parent
5795254b2a
commit
5a47cef9a8
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -1660,10 +1660,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "milli"
|
name = "milli"
|
||||||
version = "0.3.1"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/meilisearch/milli.git?tag=v0.3.1#bc020317935da4ea08061b3d4518cbbd40184856"
|
source = "git+https://github.com/meilisearch/milli.git?tag=v0.4.0#3bd4cf94cc60733393b94021fca77eb100bfe17a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"bstr",
|
"bstr",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -51,7 +51,7 @@ main_error = "0.1.0"
|
|||||||
meilisearch-error = { path = "../meilisearch-error" }
|
meilisearch-error = { path = "../meilisearch-error" }
|
||||||
meilisearch-tokenizer = { git = "https://github.com/meilisearch/Tokenizer.git", tag = "v0.2.2" }
|
meilisearch-tokenizer = { git = "https://github.com/meilisearch/Tokenizer.git", tag = "v0.2.2" }
|
||||||
memmap = "0.7.0"
|
memmap = "0.7.0"
|
||||||
milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.3.1" }
|
milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.4.0" }
|
||||||
mime = "0.3.16"
|
mime = "0.3.16"
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.5.2"
|
||||||
oxidized-json-checker = "0.3.2"
|
oxidized-json-checker = "0.3.2"
|
||||||
|
@ -369,7 +369,7 @@ fn parse_facets_array(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterCondition::from_array(txn, &index.0, ands)
|
Ok(FilterCondition::from_array(txn, &index.0, ands)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -200,8 +200,11 @@ impl Index {
|
|||||||
info!("performing document addition");
|
info!("performing document addition");
|
||||||
|
|
||||||
// Set the primary key if not set already, ignore if already set.
|
// Set the primary key if not set already, ignore if already set.
|
||||||
if let (None, Some(ref primary_key)) = (self.primary_key(txn)?, primary_key) {
|
if let (None, Some(primary_key)) = (self.primary_key(txn)?, primary_key) {
|
||||||
self.put_primary_key(txn, primary_key)?;
|
let mut builder = UpdateBuilder::new(0)
|
||||||
|
.settings(txn, &self);
|
||||||
|
builder.set_primary_key(primary_key.to_string());
|
||||||
|
builder.execute(|_, _| ())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut builder = update_builder.index_documents(txn, self);
|
let mut builder = update_builder.index_documents(txn, self);
|
||||||
@ -235,7 +238,7 @@ impl Index {
|
|||||||
.commit()
|
.commit()
|
||||||
.and(Ok(UpdateResult::Other))
|
.and(Ok(UpdateResult::Other))
|
||||||
.map_err(Into::into),
|
.map_err(Into::into),
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +334,7 @@ impl Index {
|
|||||||
.commit()
|
.commit()
|
||||||
.and(Ok(UpdateResult::DocumentDeletion { deleted }))
|
.and(Ok(UpdateResult::DocumentDeletion { deleted }))
|
||||||
.map_err(Into::into),
|
.map_err(Into::into),
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use async_stream::stream;
|
|||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
use heed::CompactionOption;
|
use heed::CompactionOption;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
use milli::update::UpdateBuilder;
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
use tokio::{fs, sync::mpsc};
|
use tokio::{fs, sync::mpsc};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
@ -258,12 +259,15 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
|
|||||||
.ok_or(IndexError::UnexistingIndex)?;
|
.ok_or(IndexError::UnexistingIndex)?;
|
||||||
|
|
||||||
let result = spawn_blocking(move || match index_settings.primary_key {
|
let result = spawn_blocking(move || match index_settings.primary_key {
|
||||||
Some(ref primary_key) => {
|
Some(primary_key) => {
|
||||||
let mut txn = index.write_txn()?;
|
let mut txn = index.write_txn()?;
|
||||||
if index.primary_key(&txn)?.is_some() {
|
if index.primary_key(&txn)?.is_some() {
|
||||||
return Err(IndexError::ExistingPrimaryKey);
|
return Err(IndexError::ExistingPrimaryKey);
|
||||||
}
|
}
|
||||||
index.put_primary_key(&mut txn, primary_key)?;
|
let mut builder = UpdateBuilder::new(0).settings(&mut txn, &index);
|
||||||
|
builder.set_primary_key(primary_key);
|
||||||
|
builder.execute(|_, _| ())
|
||||||
|
.map_err(|e| IndexError::Internal(e.to_string()))?;
|
||||||
let meta = IndexMeta::new_txn(&index, &txn)?;
|
let meta = IndexMeta::new_txn(&index, &txn)?;
|
||||||
txn.commit()?;
|
txn.commit()?;
|
||||||
Ok(meta)
|
Ok(meta)
|
||||||
@ -333,7 +337,8 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
|
|||||||
|
|
||||||
Ok(IndexStats {
|
Ok(IndexStats {
|
||||||
size: index.size(),
|
size: index.size(),
|
||||||
number_of_documents: index.number_of_documents(&rtxn)?,
|
number_of_documents: index.number_of_documents(&rtxn)
|
||||||
|
.map_err(|e| IndexError::Internal(e.to_string()))?,
|
||||||
is_indexing: None,
|
is_indexing: None,
|
||||||
fields_distribution: index.fields_distribution(&rtxn)?,
|
fields_distribution: index.fields_distribution(&rtxn)?,
|
||||||
})
|
})
|
||||||
|
@ -41,8 +41,12 @@ impl IndexMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_txn(index: &Index, txn: &heed::RoTxn) -> IndexResult<Self> {
|
fn new_txn(index: &Index, txn: &heed::RoTxn) -> IndexResult<Self> {
|
||||||
let created_at = index.created_at(&txn)?;
|
let created_at = index
|
||||||
let updated_at = index.updated_at(&txn)?;
|
.created_at(&txn)
|
||||||
|
.map_err(|e| IndexError::Internal(e.to_string()))?;
|
||||||
|
let updated_at = index
|
||||||
|
.updated_at(&txn)
|
||||||
|
.map_err(|e| IndexError::Internal(e.to_string()))?;
|
||||||
let primary_key = index.primary_key(&txn)?.map(String::from);
|
let primary_key = index.primary_key(&txn)?.map(String::from);
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
created_at,
|
created_at,
|
||||||
|
@ -2,6 +2,7 @@ use std::collections::HashMap;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use milli::update::UpdateBuilder;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
@ -57,7 +58,12 @@ impl IndexStore for MapIndexStore {
|
|||||||
let index = Index::open(path, index_size)?;
|
let index = Index::open(path, index_size)?;
|
||||||
if let Some(primary_key) = primary_key {
|
if let Some(primary_key) = primary_key {
|
||||||
let mut txn = index.write_txn()?;
|
let mut txn = index.write_txn()?;
|
||||||
index.put_primary_key(&mut txn, &primary_key)?;
|
|
||||||
|
let mut builder = UpdateBuilder::new(0).settings(&mut txn, &index);
|
||||||
|
builder.set_primary_key(primary_key);
|
||||||
|
builder.execute(|_, _| ())
|
||||||
|
.map_err(|e| IndexError::Internal(e.to_string()))?;
|
||||||
|
|
||||||
txn.commit()?;
|
txn.commit()?;
|
||||||
}
|
}
|
||||||
Ok(index)
|
Ok(index)
|
||||||
|
Loading…
Reference in New Issue
Block a user