mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
test unique document id bug
This commit is contained in:
parent
754efe1f42
commit
f54397e0cf
@ -6,7 +6,7 @@ use meilisearch_types::DocumentId;
|
|||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::{Number, FstMapCow};
|
use crate::Number;
|
||||||
use crate::raw_indexer::RawIndexer;
|
use crate::raw_indexer::RawIndexer;
|
||||||
use crate::serde::SerializerError;
|
use crate::serde::SerializerError;
|
||||||
use crate::store::DiscoverIds;
|
use crate::store::DiscoverIds;
|
||||||
|
@ -195,3 +195,23 @@ async fn add_document_with_long_field() {
|
|||||||
let (response, _status) = server.search_post(json!({ "q": "request_buffering" })).await;
|
let (response, _status) = server.search_post(json!({ "q": "request_buffering" })).await;
|
||||||
assert!(!response["hits"].as_array().unwrap().is_empty());
|
assert!(!response["hits"].as_array().unwrap().is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn documents_with_same_id_are_overwritten() {
|
||||||
|
let mut server = common::Server::with_uid("test");
|
||||||
|
server.create_index(json!({ "uid": "test"})).await;
|
||||||
|
let documents = json!([
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"content": "test1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"content": "test2"
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
server.add_or_replace_multiple_documents(documents).await;
|
||||||
|
let (response, _status) = server.get_all_documents().await;
|
||||||
|
assert_eq!(response.as_array().unwrap().len(), 1);
|
||||||
|
assert_eq!(response.as_array().unwrap()[0].as_object().unwrap()["content"], "test2");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user