mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-15 00:17:45 +00:00
Merge pull request #5602 from martin-g/faster-search-matching_strategy-it-tests
tests: Faster search::matching_strategy IT tests
This commit is contained in:
commit
4c71118699
@ -2,11 +2,11 @@ use meili_snap::snapshot;
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use crate::common::index::Index;
|
use crate::common::index::Index;
|
||||||
use crate::common::{Server, Value};
|
use crate::common::{Server, Shared, Value};
|
||||||
use crate::json;
|
use crate::json;
|
||||||
|
|
||||||
async fn index_with_documents<'a>(server: &'a Server, documents: &Value) -> Index<'a> {
|
async fn index_with_documents<'a>(server: &'a Server<Shared>, documents: &Value) -> Index<'a> {
|
||||||
let index = server.index("test");
|
let index = server.unique_index();
|
||||||
|
|
||||||
let (task, _status_code) = index.add_documents(documents.clone(), None).await;
|
let (task, _status_code) = index.add_documents(documents.clone(), None).await;
|
||||||
index.wait_task(task.uid()).await.succeeded();
|
index.wait_task(task.uid()).await.succeeded();
|
||||||
@ -48,8 +48,8 @@ static SIMPLE_SEARCH_DOCUMENTS: Lazy<Value> = Lazy::new(|| {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn simple_search() {
|
async fn simple_search() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
||||||
|
|
||||||
index
|
index
|
||||||
.search(json!({"q": "Captain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
.search(json!({"q": "Captain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
||||||
@ -75,8 +75,8 @@ async fn simple_search() {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn search_with_typo() {
|
async fn search_with_typo() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
||||||
|
|
||||||
index
|
index
|
||||||
.search(json!({"q": "Capitain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
.search(json!({"q": "Capitain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
||||||
@ -102,8 +102,8 @@ async fn search_with_typo() {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn search_with_unknown_word() {
|
async fn search_with_unknown_word() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await;
|
||||||
|
|
||||||
index
|
index
|
||||||
.search(json!({"q": "Captain Supercopter Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
.search(json!({"q": "Captain Supercopter Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user