mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 09:11:00 +00:00
restructure project
This commit is contained in:
33
meilisearch-http/src/routes/settings/stop_words.rs
Normal file
33
meilisearch-http/src/routes/settings/stop_words.rs
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
);
|
Reference in New Issue
Block a user