mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
remove legacy files from meilisearch that have been replaced by a macro in routes/settings/mod.rs
This commit is contained in:
parent
40ef9a3c6a
commit
b1962c8e02
@ -1,43 +0,0 @@
|
||||
use actix_web::{web, HttpResponse, get};
|
||||
|
||||
use crate::error::{Error, ResponseError};
|
||||
use crate::helpers::Authentication;
|
||||
use crate::make_update_delete_routes;
|
||||
use crate::Data;
|
||||
|
||||
#[get(
|
||||
"/indexes/{index_uid}/settings/attributes-for-faceting",
|
||||
wrap = "Authentication::Private"
|
||||
)]
|
||||
async fn get(
|
||||
data: web::Data<Data>,
|
||||
index_uid: web::Path<String>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let index = data
|
||||
.db
|
||||
.load()
|
||||
.open_index(&index_uid.as_ref())
|
||||
.ok_or(Error::index_not_found(&index_uid.as_ref()))?;
|
||||
|
||||
let attributes_for_faceting = data.db.load().main_read::<_, _, ResponseError>(|reader| {
|
||||
let schema = index.main.schema(reader)?;
|
||||
let attrs = index.main.attributes_for_faceting(reader)?;
|
||||
let attr_names = match (&schema, &attrs) {
|
||||
(Some(schema), Some(attrs)) => attrs
|
||||
.iter()
|
||||
.filter_map(|&id| schema.name(id))
|
||||
.map(str::to_string)
|
||||
.collect(),
|
||||
_ => vec![],
|
||||
};
|
||||
Ok(attr_names)
|
||||
})?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(attributes_for_faceting))
|
||||
}
|
||||
|
||||
make_update_delete_routes!(
|
||||
"/indexes/{index_uid}/settings/attributes-for-faceting",
|
||||
Vec<String>,
|
||||
attributes_for_faceting
|
||||
);
|
@ -1,25 +0,0 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use actix_web::{web, HttpResponse, get};
|
||||
|
||||
use crate::error::{Error, ResponseError};
|
||||
use crate::helpers::Authentication;
|
||||
use crate::make_update_delete_routes;
|
||||
use crate::Data;
|
||||
|
||||
#[get(
|
||||
"/indexes/{index_uid}/settings/displayed-attributes",
|
||||
wrap = "Authentication::Private"
|
||||
)]
|
||||
async fn get(
|
||||
data: web::Data<Data>,
|
||||
index_uid: web::Path<String>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
make_update_delete_routes!(
|
||||
"/indexes/{index_uid}/settings/displayed-attributes",
|
||||
HashSet<String>,
|
||||
displayed_attributes
|
||||
);
|
@ -1,34 +0,0 @@
|
||||
use actix_web::{web, HttpResponse, get};
|
||||
|
||||
use crate::data::get_indexed_attributes;
|
||||
use crate::error::{Error, ResponseError};
|
||||
use crate::helpers::Authentication;
|
||||
use crate::make_update_delete_routes;
|
||||
use crate::Data;
|
||||
|
||||
#[get(
|
||||
"/indexes/{index_uid}/settings/searchable-attributes",
|
||||
wrap = "Authentication::Private"
|
||||
)]
|
||||
async fn get(
|
||||
data: web::Data<Data>,
|
||||
index_uid: web::Path<String>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let index = data
|
||||
.db
|
||||
.load()
|
||||
.open_index(&index_uid.as_ref())
|
||||
|
||||
.ok_or(Error::index_not_found(&index_uid.as_ref()))?;
|
||||
let reader = data.db.load().main_read_txn()?;
|
||||
let schema = index.main.schema(&reader)?;
|
||||
let searchable_attributes: Option<Vec<String>> = schema.as_ref().map(get_indexed_attributes);
|
||||
|
||||
Ok(HttpResponse::Ok().json(searchable_attributes))
|
||||
}
|
||||
|
||||
make_update_delete_routes!(
|
||||
"/indexes/{index_uid}/settings/searchable-attributes",
|
||||
Vec<String>,
|
||||
searchable_attributes
|
||||
);
|
@ -1,33 +0,0 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use crate::make_update_delete_routes;
|
||||
use actix_web::{web, HttpResponse, get};
|
||||
|
||||
use crate::error::{Error, ResponseError};
|
||||
use crate::helpers::Authentication;
|
||||
use crate::Data;
|
||||
|
||||
#[get(
|
||||
"/indexes/{index_uid}/settings/stop-words",
|
||||
wrap = "Authentication::Private"
|
||||
)]
|
||||
async fn get(
|
||||
data: web::Data<Data>,
|
||||
index_uid: web::Path<String>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let index = data
|
||||
.db
|
||||
.load()
|
||||
.open_index(&index_uid.as_ref())
|
||||
.ok_or(Error::index_not_found(&index_uid.as_ref()))?;
|
||||
let reader = data.db.load().main_read_txn()?;
|
||||
let stop_words = index.main.stop_words(&reader)?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(stop_words))
|
||||
}
|
||||
|
||||
make_update_delete_routes!(
|
||||
"/indexes/{index_uid}/settings/stop-words",
|
||||
BTreeSet<String>,
|
||||
stop_words
|
||||
);
|
@ -30,7 +30,7 @@ async fn get_settings() {
|
||||
"exactness"
|
||||
])
|
||||
);
|
||||
assert_eq!(settings["stopWords"], json!(null));
|
||||
assert_eq!(settings["stopWords"], json!([]));
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user