mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-29 16:24:26 +01:00
Adds a test to check that stop word ar correctly handled
This commit is contained in:
parent
29d021ad4d
commit
d24209f5a7
@ -6,11 +6,7 @@ mod common;
|
|||||||
#[test]
|
#[test]
|
||||||
fn update_stop_words() {
|
fn update_stop_words() {
|
||||||
let mut server = common::Server::with_uid("movies");
|
let mut server = common::Server::with_uid("movies");
|
||||||
let body = json!({
|
server.populate_movies();
|
||||||
"uid": "movies",
|
|
||||||
"primaryKey": "id",
|
|
||||||
});
|
|
||||||
server.create_index(body);
|
|
||||||
|
|
||||||
// 1 - Get stop words
|
// 1 - Get stop words
|
||||||
|
|
||||||
@ -36,3 +32,32 @@ fn update_stop_words() {
|
|||||||
let (response, _status_code) = server.get_stop_words();
|
let (response, _status_code) = server.get_stop_words();
|
||||||
assert_eq!(response.as_array().unwrap().is_empty(), true);
|
assert_eq!(response.as_array().unwrap().is_empty(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_documents_and_stop_words() {
|
||||||
|
let mut server = common::Server::with_uid("movies");
|
||||||
|
server.populate_movies();
|
||||||
|
|
||||||
|
// 2 - Update stop words
|
||||||
|
|
||||||
|
let body = json!(["the", "of"]);
|
||||||
|
server.update_stop_words(body.clone());
|
||||||
|
|
||||||
|
// 3 - Search for a document with stop words
|
||||||
|
|
||||||
|
let (response, _status_code) = server.search("q=the%20mask");
|
||||||
|
assert!(!response["hits"].as_array().unwrap().is_empty());
|
||||||
|
|
||||||
|
// 4 - Search for documents with *only* stop words
|
||||||
|
|
||||||
|
let (response, _status_code) = server.search("q=the%20of");
|
||||||
|
assert!(response["hits"].as_array().unwrap().is_empty());
|
||||||
|
|
||||||
|
// 5 - Delete all stop words
|
||||||
|
|
||||||
|
// server.delete_stop_words();
|
||||||
|
|
||||||
|
// // 6 - Search for a document with one stop word
|
||||||
|
|
||||||
|
// assert!(!response["hits"].as_array().unwrap().is_empty());
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user