rebase from master

This commit is contained in:
Quentin de Quelen 2020-02-02 22:59:19 +01:00 committed by qdequele
parent 2143226f04
commit dc6907e748
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
29 changed files with 92 additions and 105 deletions

BIN
meilisearch-http/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -15,17 +15,19 @@ path = "src/main.rs"
[dependencies]
async-std = { version = "1.0.1", features = ["attributes"] }
bincode = "1.2.0"
chrono = { version = "0.4.9", features = ["serde"] }
crossbeam-channel = "0.4.0"
env_logger = "0.7.1"
futures = "0.3.1"
heed = "0.6.1"
http = "0.1.19"
http-service = "0.4.0"
indexmap = { version = "1.3.0", features = ["serde-1"] }
log = "0.4.8"
main_error = "0.1.0"
meilisearch-core = { path = "../meilisearch-core", version = "0.8.4" }
meilisearch-schema = { path = "../meilisearch-schema", version = "0.8.4" }
mime = "0.3.16"
pretty-bytes = "0.2.2"
rand = "0.7.2"
rayon = "1.2.0"
@ -39,9 +41,6 @@ tide = "0.6.0"
ureq = { version = "0.11.2", features = ["tls"], default-features = false }
walkdir = "2.2.9"
whoami = "0.6"
http-service = "0.4.0"
futures = "0.3.1"
mime = "0.3.16"
[dev-dependencies]
http-service-mock = "0.4.0"

View file

@ -5,6 +5,7 @@ use log::{error, warn};
use serde::{Deserialize, Serialize};
use tide::IntoResponse;
use tide::Response;
use meilisearch_core::{HeedError, FstError};
use crate::helpers::meilisearch::Error as SearchError;
@ -139,14 +140,14 @@ impl From<meilisearch_core::Error> for ResponseError {
}
}
impl From<heed::Error> for ResponseError {
fn from(err: heed::Error) -> ResponseError {
impl From<HeedError> for ResponseError {
fn from(err: HeedError) -> ResponseError {
ResponseError::internal(err)
}
}
impl From<meilisearch_core::FstError> for ResponseError {
fn from(err: meilisearch_core::FstError) -> ResponseError {
impl From<FstError> for ResponseError {
fn from(err: FstError) -> ResponseError {
ResponseError::internal(err)
}
}

View file

@ -38,7 +38,7 @@ pub fn load_routes(app: &mut tide::Server<Data>) {
}
});
app.at("/indexes/")
app.at("/indexes")
.get(|ctx| into_response(index::list_indexes(ctx)))
.post(|ctx| into_response(index::create_index(ctx)));
@ -95,7 +95,7 @@ pub fn load_routes(app: &mut tide::Server<Data>) {
.post(|ctx| into_response(setting::update_searchable(ctx)))
.delete(|ctx| into_response(setting::delete_searchable(ctx)));
app.at("/indexes/:index/settings/displayed-attribute")
app.at("/indexes/:index/settings/displayed-attributes")
.get(|ctx| into_response(setting::displayed(ctx)))
.post(|ctx| into_response(setting::update_displayed(ctx)))
.delete(|ctx| into_response(setting::delete_displayed(ctx)));

BIN
meilisearch-http/tests/.DS_Store vendored Normal file

Binary file not shown.

BIN
meilisearch-http/tests/assets/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -36,6 +36,7 @@ pub fn enrich_server_with_movies_index(
) -> Result<(), Box<dyn Error>> {
let body = json!({
"uid": "movies",
"identifier": "id",
})
.to_string()
.into_bytes();
@ -114,7 +115,7 @@ pub fn enrich_server_with_movies_documents(
.unwrap();
let _res = server.simulate(req).unwrap();
block_on(sleep(Duration::from_secs(5)));
block_on(sleep(Duration::from_secs(10)));
Ok(())
}

View file

@ -902,8 +902,8 @@ fn search_with_settings_synonyms() {
"Action",
"Science Fiction"
],
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg",
"vote_count": 16056
"vote_count": 16056,
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg"
},
{
"id": 299534,
@ -919,25 +919,25 @@ fn search_with_settings_synonyms() {
"Science Fiction",
"Action"
],
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg",
"vote_count": 10497
"vote_count": 10497,
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg"
},
{
"id": 271110,
"popularity": 37.431,
"vote_average": 7.4,
"title": "Captain America: Civil War",
"tagline": "Divided We Fall",
"overview": "Following the events of Age of Ultron, the collective governments of the world pass an act designed to regulate all superhuman activity. This polarizes opinion amongst the Avengers, causing two factions to side with Iron Man or Captain America, which causes an epic battle between former allies.",
"director": "Anthony Russo",
"id": 99861,
"popularity": 33.938,
"vote_average": 7.3,
"title": "Avengers: Age of Ultron",
"tagline": "A New Age Has Come.",
"overview": "When Tony Stark tries to jumpstart a dormant peacekeeping program, things go awry and Earths Mightiest Heroes are put to the ultimate test as the fate of the planet hangs in the balance. As the villainous Ultron emerges, it is up to The Avengers to stop him from enacting his terrible plans, and soon uneasy alliances and unexpected action pave the way for an epic and unique global adventure.",
"director": "Joss Whedon",
"producer": "Kevin Feige",
"genres": [
"Adventure",
"Action",
"Adventure",
"Science Fiction"
],
"poster_path": "https://image.tmdb.org/t/p/w500/kSBXou5Ac7vEqKd97wotJumyJvU.jpg",
"vote_count": 15079
"vote_count": 14661,
"poster_path": "https://image.tmdb.org/t/p/w500/t90Y3G8UGQp0f0DrP60wRu9gfrH.jpg"
}
]);

View file

@ -50,9 +50,9 @@ fn write_all_and_delete() {
"dsc(rank)",
],
"rankingDistinct": "movie_id",
"identifier": "uid",
"identifier": "id",
"searchableAttributes": [
"uid",
"id",
"movie_id",
"title",
"description",

View file

@ -73,7 +73,7 @@ fn write_all_and_delete() {
let mut buf = Vec::new();
block_on(res.into_body().read_to_end(&mut buf)).unwrap();
let res_value: Value = serde_json::from_slice(&buf).unwrap();
println!("1: {:?} vs {:?}", json, res_value);
assert_json_eq!(json, res_value, ordered: false);
// 4 - Delete all settings
@ -102,7 +102,7 @@ fn write_all_and_delete() {
"rankingRules": null,
"rankingDistinct": null,
});
println!("2: {:?} vs {:?}", json, res_value);
assert_json_eq!(json, res_value, ordered: false);
}