2022-09-27 16:33:37 +02:00
|
|
|
use actix_web::web::Data;
|
2021-12-02 16:03:26 +01:00
|
|
|
use actix_web::{web, HttpRequest, HttpResponse};
|
2022-10-13 11:09:00 +02:00
|
|
|
use index_scheduler::{IndexScheduler, Query, TaskId};
|
2022-06-06 12:38:46 +02:00
|
|
|
use meilisearch_types::error::ResponseError;
|
|
|
|
use meilisearch_types::index_uid::IndexUid;
|
2022-10-12 03:21:25 +02:00
|
|
|
use meilisearch_types::settings::{Settings, Unchecked};
|
2022-06-06 12:45:52 +02:00
|
|
|
use meilisearch_types::star_or::StarOr;
|
2022-10-13 11:09:00 +02:00
|
|
|
use meilisearch_types::tasks::{serialize_duration, Details, Kind, KindWithContent, Status, Task};
|
2022-10-12 03:21:25 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-05-17 16:08:23 +02:00
|
|
|
use serde_cs::vec::CS;
|
2021-12-02 16:03:26 +01:00
|
|
|
use serde_json::json;
|
2022-10-12 03:21:25 +02:00
|
|
|
use time::{Duration, OffsetDateTime};
|
2021-12-02 16:03:26 +01:00
|
|
|
|
|
|
|
use crate::analytics::Analytics;
|
|
|
|
use crate::extractors::authentication::{policies::*, GuardedData};
|
2022-03-04 20:12:44 +01:00
|
|
|
use crate::extractors::sequential_extractor::SeqHandler;
|
2021-12-02 16:03:26 +01:00
|
|
|
|
2022-06-06 12:45:52 +02:00
|
|
|
use super::fold_star_or;
|
2022-05-25 11:51:26 +02:00
|
|
|
|
2022-09-27 16:33:37 +02:00
|
|
|
const DEFAULT_LIMIT: fn() -> u32 = || 20;
|
2022-06-01 12:04:01 +02:00
|
|
|
|
2021-12-02 16:03:26 +01:00
|
|
|
pub fn configure(cfg: &mut web::ServiceConfig) {
|
2022-10-13 12:48:23 +02:00
|
|
|
cfg.service(
|
|
|
|
web::resource("")
|
|
|
|
.route(web::get().to(SeqHandler(get_tasks)))
|
|
|
|
.route(web::delete().to(SeqHandler(delete_tasks))),
|
|
|
|
)
|
|
|
|
.service(web::resource("/{task_id}").route(web::get().to(SeqHandler(get_task))));
|
2021-12-02 16:03:26 +01:00
|
|
|
}
|
|
|
|
|
2022-10-12 03:21:25 +02:00
|
|
|
#[derive(Debug, Clone, PartialEq, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct TaskView {
|
|
|
|
pub uid: TaskId,
|
|
|
|
#[serde(default)]
|
|
|
|
pub index_uid: Option<String>,
|
|
|
|
pub status: Status,
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub kind: Kind,
|
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub details: Option<DetailsView>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub error: Option<ResponseError>,
|
|
|
|
|
|
|
|
#[serde(
|
|
|
|
serialize_with = "serialize_duration",
|
|
|
|
skip_serializing_if = "Option::is_none",
|
|
|
|
default
|
|
|
|
)]
|
|
|
|
pub duration: Option<Duration>,
|
|
|
|
#[serde(with = "time::serde::rfc3339")]
|
|
|
|
pub enqueued_at: OffsetDateTime,
|
|
|
|
#[serde(
|
|
|
|
with = "time::serde::rfc3339::option",
|
|
|
|
skip_serializing_if = "Option::is_none",
|
|
|
|
default
|
|
|
|
)]
|
|
|
|
pub started_at: Option<OffsetDateTime>,
|
|
|
|
#[serde(
|
|
|
|
with = "time::serde::rfc3339::option",
|
|
|
|
skip_serializing_if = "Option::is_none",
|
|
|
|
default
|
|
|
|
)]
|
|
|
|
pub finished_at: Option<OffsetDateTime>,
|
|
|
|
}
|
|
|
|
|
2022-10-13 12:48:23 +02:00
|
|
|
impl TaskView {
|
|
|
|
fn from_task(task: &Task) -> TaskView {
|
2022-10-12 03:21:25 +02:00
|
|
|
TaskView {
|
|
|
|
uid: task.uid,
|
|
|
|
index_uid: task
|
|
|
|
.indexes()
|
|
|
|
.and_then(|vec| vec.first().map(|i| i.to_string())),
|
|
|
|
status: task.status,
|
|
|
|
kind: task.kind.as_kind(),
|
2022-10-13 12:48:23 +02:00
|
|
|
details: task.details.clone().map(DetailsView::from),
|
2022-10-12 03:21:25 +02:00
|
|
|
error: task.error.clone(),
|
|
|
|
duration: task
|
|
|
|
.started_at
|
|
|
|
.zip(task.finished_at)
|
|
|
|
.map(|(start, end)| end - start),
|
|
|
|
enqueued_at: task.enqueued_at,
|
|
|
|
started_at: task.started_at,
|
|
|
|
finished_at: task.finished_at,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, Clone, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct DetailsView {
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub received_documents: Option<u64>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub indexed_documents: Option<u64>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub primary_key: Option<Option<String>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub received_document_ids: Option<usize>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub deleted_documents: Option<Option<u64>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2022-10-17 20:07:53 +02:00
|
|
|
pub matched_tasks: Option<u64>,
|
2022-10-12 03:21:25 +02:00
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2022-10-18 13:47:22 +02:00
|
|
|
pub canceled_tasks: Option<Option<usize>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2022-10-12 03:21:25 +02:00
|
|
|
pub deleted_tasks: Option<Option<usize>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub original_query: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub dump_uid: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub settings: Option<Settings<Unchecked>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<Details> for DetailsView {
|
|
|
|
fn from(details: Details) -> Self {
|
|
|
|
match details.clone() {
|
|
|
|
Details::DocumentAddition {
|
|
|
|
received_documents,
|
|
|
|
indexed_documents,
|
|
|
|
} => DetailsView {
|
|
|
|
received_documents: Some(received_documents),
|
2022-10-13 15:02:59 +02:00
|
|
|
indexed_documents,
|
2022-10-12 03:21:25 +02:00
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
Details::Settings { settings } => DetailsView {
|
|
|
|
settings: Some(settings),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
Details::IndexInfo { primary_key } => DetailsView {
|
|
|
|
primary_key: Some(primary_key),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
Details::DocumentDeletion {
|
|
|
|
received_document_ids,
|
|
|
|
deleted_documents,
|
|
|
|
} => DetailsView {
|
|
|
|
received_document_ids: Some(received_document_ids),
|
|
|
|
deleted_documents: Some(deleted_documents),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
Details::ClearAll { deleted_documents } => DetailsView {
|
|
|
|
deleted_documents: Some(deleted_documents),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
2022-10-18 13:47:22 +02:00
|
|
|
Details::TaskCancelation {
|
|
|
|
matched_tasks,
|
|
|
|
canceled_tasks,
|
|
|
|
original_query,
|
|
|
|
} => DetailsView {
|
|
|
|
matched_tasks: Some(matched_tasks),
|
|
|
|
canceled_tasks: Some(canceled_tasks),
|
|
|
|
original_query: Some(original_query),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
2022-10-13 11:09:00 +02:00
|
|
|
Details::TaskDeletion {
|
2022-10-12 03:21:25 +02:00
|
|
|
matched_tasks,
|
|
|
|
deleted_tasks,
|
|
|
|
original_query,
|
|
|
|
} => DetailsView {
|
|
|
|
matched_tasks: Some(matched_tasks),
|
|
|
|
deleted_tasks: Some(deleted_tasks),
|
|
|
|
original_query: Some(original_query),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
Details::Dump { dump_uid } => DetailsView {
|
|
|
|
dump_uid: Some(dump_uid),
|
|
|
|
..DetailsView::default()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-17 16:08:23 +02:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
2022-07-07 10:56:02 +02:00
|
|
|
pub struct TasksFilterQuery {
|
2022-05-17 16:08:23 +02:00
|
|
|
#[serde(rename = "type")]
|
2022-09-22 12:14:51 +02:00
|
|
|
type_: Option<CS<StarOr<Kind>>>,
|
|
|
|
status: Option<CS<StarOr<Status>>>,
|
2022-05-30 17:01:51 +02:00
|
|
|
index_uid: Option<CS<StarOr<IndexUid>>>,
|
2022-06-01 12:04:01 +02:00
|
|
|
#[serde(default = "DEFAULT_LIMIT")]
|
2022-09-27 16:33:37 +02:00
|
|
|
limit: u32,
|
2022-06-01 15:30:39 +02:00
|
|
|
from: Option<TaskId>,
|
2022-05-30 13:59:27 +02:00
|
|
|
}
|
|
|
|
|
2022-10-13 12:48:23 +02:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
|
|
pub struct TaskDeletionQuery {
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
type_: Option<CS<Kind>>,
|
|
|
|
uid: Option<CS<u32>>,
|
|
|
|
status: Option<CS<Status>>,
|
|
|
|
index_uid: Option<CS<IndexUid>>,
|
2022-05-18 12:07:06 +02:00
|
|
|
}
|
|
|
|
|
2022-10-13 11:09:00 +02:00
|
|
|
async fn delete_tasks(
|
|
|
|
index_scheduler: GuardedData<ActionPolicy<{ actions::TASKS_DELETE }>, Data<IndexScheduler>>,
|
2022-10-13 12:48:23 +02:00
|
|
|
params: web::Query<TaskDeletionQuery>,
|
2022-10-13 11:09:00 +02:00
|
|
|
) -> Result<HttpResponse, ResponseError> {
|
2022-10-13 12:48:23 +02:00
|
|
|
let TaskDeletionQuery {
|
|
|
|
type_,
|
|
|
|
uid,
|
|
|
|
status,
|
|
|
|
index_uid,
|
|
|
|
} = params.into_inner();
|
|
|
|
|
|
|
|
let kind: Option<Vec<_>> = type_.map(|x| x.into_iter().collect());
|
|
|
|
let uid: Option<Vec<_>> = uid.map(|x| x.into_iter().collect());
|
|
|
|
let status: Option<Vec<_>> = status.map(|x| x.into_iter().collect());
|
|
|
|
let index_uid: Option<Vec<_>> =
|
|
|
|
index_uid.map(|x| x.into_iter().map(|x| x.to_string()).collect());
|
|
|
|
|
|
|
|
let query = Query {
|
|
|
|
limit: None,
|
|
|
|
from: None,
|
|
|
|
status,
|
|
|
|
kind,
|
|
|
|
index_uid,
|
|
|
|
uid,
|
|
|
|
};
|
2022-10-15 11:17:06 +02:00
|
|
|
if query.is_empty() {
|
|
|
|
return Err(index_scheduler::Error::TaskDeletionWithEmptyQuery.into());
|
|
|
|
}
|
2022-10-13 12:48:23 +02:00
|
|
|
|
2022-10-13 11:09:00 +02:00
|
|
|
let filtered_query = filter_out_inaccessible_indexes_from_query(&index_scheduler, &query);
|
|
|
|
|
|
|
|
let tasks = index_scheduler.get_task_ids(&filtered_query)?;
|
|
|
|
let filtered_query_string = yaup::to_string(&filtered_query).unwrap();
|
|
|
|
let task_deletion = KindWithContent::TaskDeletion {
|
|
|
|
query: filtered_query_string,
|
|
|
|
tasks,
|
|
|
|
};
|
2022-10-15 11:03:24 +02:00
|
|
|
|
2022-10-13 11:09:00 +02:00
|
|
|
let task = index_scheduler.register(task_deletion)?;
|
|
|
|
|
2022-10-13 12:48:23 +02:00
|
|
|
let task_view = TaskView::from_task(&task);
|
2022-10-13 11:09:00 +02:00
|
|
|
|
|
|
|
Ok(HttpResponse::Ok().json(task_view))
|
|
|
|
}
|
|
|
|
|
2021-12-02 16:03:26 +01:00
|
|
|
async fn get_tasks(
|
2022-09-27 16:33:37 +02:00
|
|
|
index_scheduler: GuardedData<ActionPolicy<{ actions::TASKS_GET }>, Data<IndexScheduler>>,
|
2022-07-07 10:56:02 +02:00
|
|
|
params: web::Query<TasksFilterQuery>,
|
2021-12-02 16:03:26 +01:00
|
|
|
req: HttpRequest,
|
|
|
|
analytics: web::Data<dyn Analytics>,
|
|
|
|
) -> Result<HttpResponse, ResponseError> {
|
2022-07-07 10:56:02 +02:00
|
|
|
let TasksFilterQuery {
|
2022-05-17 16:08:23 +02:00
|
|
|
type_,
|
|
|
|
status,
|
|
|
|
index_uid,
|
2022-05-31 11:56:51 +02:00
|
|
|
limit,
|
2022-06-01 15:30:39 +02:00
|
|
|
from,
|
2022-05-17 16:08:23 +02:00
|
|
|
} = params.into_inner();
|
|
|
|
|
2022-09-27 16:33:37 +02:00
|
|
|
let search_rules = &index_scheduler.filters().search_rules;
|
2022-05-18 12:07:06 +02:00
|
|
|
|
2022-05-31 11:56:51 +02:00
|
|
|
// We first transform a potential indexUid=* into a "not specified indexUid filter"
|
2022-05-30 17:12:53 +02:00
|
|
|
// for every one of the filters: type, status, and indexUid.
|
2022-06-06 10:17:33 +02:00
|
|
|
let type_: Option<Vec<_>> = type_.and_then(fold_star_or);
|
|
|
|
let status: Option<Vec<_>> = status.and_then(fold_star_or);
|
|
|
|
let index_uid: Option<Vec<_>> = index_uid.and_then(fold_star_or);
|
2022-05-30 17:12:53 +02:00
|
|
|
|
2022-07-07 10:56:02 +02:00
|
|
|
analytics.publish(
|
|
|
|
"Tasks Seen".to_string(),
|
|
|
|
json!({
|
|
|
|
"filtered_by_index_uid": index_uid.as_ref().map_or(false, |v| !v.is_empty()),
|
|
|
|
"filtered_by_type": type_.as_ref().map_or(false, |v| !v.is_empty()),
|
|
|
|
"filtered_by_status": status.as_ref().map_or(false, |v| !v.is_empty()),
|
|
|
|
}),
|
|
|
|
Some(&req),
|
|
|
|
);
|
|
|
|
|
2022-10-15 11:17:06 +02:00
|
|
|
// TODO: Lo: use `filter_out_inaccessible_indexes_from_query` here
|
2022-09-22 12:14:51 +02:00
|
|
|
let mut filters = index_scheduler::Query::default();
|
|
|
|
|
2022-05-30 17:12:53 +02:00
|
|
|
// Then we filter on potential indexes and make sure that the search filter
|
|
|
|
// restrictions are also applied.
|
2022-09-22 12:14:51 +02:00
|
|
|
match index_uid {
|
2022-05-17 16:08:23 +02:00
|
|
|
Some(indexes) => {
|
2022-05-30 13:59:27 +02:00
|
|
|
for name in indexes {
|
2022-05-17 16:08:23 +02:00
|
|
|
if search_rules.is_index_authorized(&name) {
|
2022-09-22 12:14:51 +02:00
|
|
|
filters = filters.with_index(name.to_string());
|
2022-05-17 16:08:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
None => {
|
2022-09-22 12:14:51 +02:00
|
|
|
if !search_rules.is_index_authorized("*") {
|
2022-05-17 16:08:23 +02:00
|
|
|
for (index, _policy) in search_rules.clone() {
|
2022-09-22 12:14:51 +02:00
|
|
|
filters = filters.with_index(index.to_string());
|
2022-05-17 16:08:23 +02:00
|
|
|
}
|
|
|
|
}
|
2021-12-06 15:45:41 +01:00
|
|
|
}
|
2022-01-12 15:35:33 +01:00
|
|
|
};
|
2021-12-06 15:45:41 +01:00
|
|
|
|
2022-09-22 12:14:51 +02:00
|
|
|
if let Some(kinds) = type_ {
|
|
|
|
for kind in kinds {
|
|
|
|
filters = filters.with_kind(kind);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(statuses) = status {
|
|
|
|
for status in statuses {
|
|
|
|
filters = filters.with_status(status);
|
|
|
|
}
|
|
|
|
}
|
2022-05-18 12:07:06 +02:00
|
|
|
|
2022-09-27 16:33:37 +02:00
|
|
|
filters.from = from;
|
2022-05-31 11:56:51 +02:00
|
|
|
// We +1 just to know if there is more after this "page" or not.
|
2022-06-01 12:04:01 +02:00
|
|
|
let limit = limit.saturating_add(1);
|
2022-10-13 12:48:23 +02:00
|
|
|
filters.limit = Some(limit);
|
2022-05-31 11:56:51 +02:00
|
|
|
|
2022-10-13 12:48:23 +02:00
|
|
|
let mut tasks_results: Vec<TaskView> = index_scheduler
|
|
|
|
.get_tasks(filters)?
|
|
|
|
.into_iter()
|
|
|
|
.map(|t| TaskView::from_task(&t))
|
|
|
|
.collect();
|
2022-05-31 11:56:51 +02:00
|
|
|
|
|
|
|
// If we were able to fetch the number +1 tasks we asked
|
|
|
|
// it means that there is more to come.
|
2022-09-27 16:33:37 +02:00
|
|
|
let next = if tasks_results.len() == limit as usize {
|
2022-06-01 15:30:39 +02:00
|
|
|
tasks_results.pop().map(|t| t.uid)
|
2022-05-31 11:56:51 +02:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
2022-06-01 15:30:39 +02:00
|
|
|
let from = tasks_results.first().map(|t| t.uid);
|
|
|
|
|
2022-09-22 12:14:51 +02:00
|
|
|
// TODO: TAMO: define a structure to represent this type
|
|
|
|
let tasks = json!({
|
|
|
|
"results": tasks_results,
|
|
|
|
"limit": limit.saturating_sub(1),
|
|
|
|
"from": from,
|
|
|
|
"next": next,
|
|
|
|
});
|
2021-12-02 16:03:26 +01:00
|
|
|
|
|
|
|
Ok(HttpResponse::Ok().json(tasks))
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn get_task(
|
2022-09-27 16:33:37 +02:00
|
|
|
index_scheduler: GuardedData<ActionPolicy<{ actions::TASKS_GET }>, Data<IndexScheduler>>,
|
2021-12-02 16:03:26 +01:00
|
|
|
task_id: web::Path<TaskId>,
|
|
|
|
req: HttpRequest,
|
|
|
|
analytics: web::Data<dyn Analytics>,
|
|
|
|
) -> Result<HttpResponse, ResponseError> {
|
2022-09-22 20:02:55 +02:00
|
|
|
let task_id = task_id.into_inner();
|
|
|
|
|
2021-12-02 16:03:26 +01:00
|
|
|
analytics.publish(
|
|
|
|
"Tasks Seen".to_string(),
|
|
|
|
json!({ "per_task_uid": true }),
|
|
|
|
Some(&req),
|
|
|
|
);
|
|
|
|
|
2022-09-27 16:33:37 +02:00
|
|
|
let search_rules = &index_scheduler.filters().search_rules;
|
2022-09-22 12:14:51 +02:00
|
|
|
let mut filters = index_scheduler::Query::default();
|
|
|
|
if !search_rules.is_index_authorized("*") {
|
2022-01-12 15:35:33 +01:00
|
|
|
for (index, _policy) in search_rules.clone() {
|
2022-09-22 12:14:51 +02:00
|
|
|
filters = filters.with_index(index);
|
2021-12-06 15:45:41 +01:00
|
|
|
}
|
2022-09-22 12:14:51 +02:00
|
|
|
}
|
|
|
|
|
2022-09-22 20:02:55 +02:00
|
|
|
filters.uid = Some(vec![task_id]);
|
2021-12-02 16:03:26 +01:00
|
|
|
|
2022-09-27 16:33:37 +02:00
|
|
|
if let Some(task) = index_scheduler.get_tasks(filters)?.first() {
|
2022-10-13 12:48:23 +02:00
|
|
|
let task_view = TaskView::from_task(&task);
|
|
|
|
Ok(HttpResponse::Ok().json(task_view))
|
2022-09-22 20:02:55 +02:00
|
|
|
} else {
|
|
|
|
Err(index_scheduler::Error::TaskNotFound(task_id).into())
|
|
|
|
}
|
2021-12-02 16:03:26 +01:00
|
|
|
}
|
2022-10-13 11:09:00 +02:00
|
|
|
|
|
|
|
fn filter_out_inaccessible_indexes_from_query<const ACTION: u8>(
|
|
|
|
index_scheduler: &GuardedData<ActionPolicy<ACTION>, Data<IndexScheduler>>,
|
|
|
|
query: &Query,
|
|
|
|
) -> Query {
|
|
|
|
let mut query = query.clone();
|
|
|
|
|
|
|
|
// First remove all indexes from the query, we will add them back later
|
|
|
|
let indexes = query.index_uid.take();
|
|
|
|
|
|
|
|
let search_rules = &index_scheduler.filters().search_rules;
|
|
|
|
|
|
|
|
// We filter on potential indexes and make sure that the search filter
|
|
|
|
// restrictions are also applied.
|
|
|
|
match indexes {
|
|
|
|
Some(indexes) => {
|
|
|
|
for name in indexes.iter() {
|
|
|
|
if search_rules.is_index_authorized(&name) {
|
|
|
|
query = query.with_index(name.to_string());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
None => {
|
|
|
|
if !search_rules.is_index_authorized("*") {
|
|
|
|
for (index, _policy) in search_rules.clone() {
|
|
|
|
query = query.with_index(index.to_string());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
query
|
|
|
|
}
|