mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-12-14 16:36:57 +00:00
Compare commits
2 Commits
document-j
...
proper-def
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0be7db9b42 | ||
|
|
051c084aba |
12
.github/workflows/sdks-tests.yml
vendored
12
.github/workflows/sdks-tests.yml
vendored
@@ -25,18 +25,14 @@ jobs:
|
|||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Define the Docker image we need to use
|
- name: Define the Docker image we need to use
|
||||||
id: define-image
|
id: define-image
|
||||||
env:
|
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
|
||||||
DOCKER_IMAGE_INPUT: ${{ github.event.inputs.docker_image }}
|
|
||||||
run: |
|
run: |
|
||||||
|
event=${{ github.event_name }}
|
||||||
echo "docker-image=nightly" >> $GITHUB_OUTPUT
|
echo "docker-image=nightly" >> $GITHUB_OUTPUT
|
||||||
if [[ "$EVENT_NAME" == 'workflow_dispatch' ]]; then
|
if [[ $event == 'workflow_dispatch' ]]; then
|
||||||
echo "docker-image=$DOCKER_IMAGE_INPUT" >> $GITHUB_OUTPUT
|
echo "docker-image=${{ github.event.inputs.docker_image }}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: Docker image is ${{ steps.define-image.outputs.docker-image }}
|
- name: Docker image is ${{ steps.define-image.outputs.docker-image }}
|
||||||
env:
|
run: echo "Docker image is ${{ steps.define-image.outputs.docker-image }}"
|
||||||
DOCKER_IMAGE: ${{ steps.define-image.outputs.docker-image }}
|
|
||||||
run: echo "Docker image is $DOCKER_IMAGE"
|
|
||||||
|
|
||||||
##########
|
##########
|
||||||
## SDKs ##
|
## SDKs ##
|
||||||
|
|||||||
@@ -317,7 +317,6 @@ pub(crate) mod test {
|
|||||||
FilterableAttributesRule::Field(S("race")),
|
FilterableAttributesRule::Field(S("race")),
|
||||||
FilterableAttributesRule::Field(S("age")),
|
FilterableAttributesRule::Field(S("age")),
|
||||||
]),
|
]),
|
||||||
foreign_keys: Setting::NotSet,
|
|
||||||
sortable_attributes: Setting::Set(btreeset! { S("age") }),
|
sortable_attributes: Setting::Set(btreeset! { S("age") }),
|
||||||
ranking_rules: Setting::NotSet,
|
ranking_rules: Setting::NotSet,
|
||||||
stop_words: Setting::NotSet,
|
stop_words: Setting::NotSet,
|
||||||
|
|||||||
@@ -349,7 +349,6 @@ impl<T> From<v5::Settings<T>> for v6::Settings<v6::Unchecked> {
|
|||||||
v5::settings::Setting::Reset => v6::Setting::Reset,
|
v5::settings::Setting::Reset => v6::Setting::Reset,
|
||||||
v5::settings::Setting::NotSet => v6::Setting::NotSet,
|
v5::settings::Setting::NotSet => v6::Setting::NotSet,
|
||||||
},
|
},
|
||||||
foreign_keys: v6::Setting::NotSet,
|
|
||||||
sortable_attributes: settings.sortable_attributes.into(),
|
sortable_attributes: settings.sortable_attributes.into(),
|
||||||
ranking_rules: {
|
ranking_rules: {
|
||||||
match settings.ranking_rules {
|
match settings.ranking_rules {
|
||||||
|
|||||||
@@ -171,19 +171,6 @@ impl RoFeatures {
|
|||||||
.into())
|
.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_foreign_keys_setting(&self, disabled_action: &'static str) -> Result<()> {
|
|
||||||
if self.runtime.foreign_keys {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(FeatureNotEnabledError {
|
|
||||||
disabled_action,
|
|
||||||
feature: "foreign_keys",
|
|
||||||
issue_link: "https://github.com/orgs/meilisearch/discussions/873",
|
|
||||||
}
|
|
||||||
.into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FeatureData {
|
impl FeatureData {
|
||||||
|
|||||||
@@ -502,13 +502,11 @@ impl Queue {
|
|||||||
*before_finished_at,
|
*before_finished_at,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(limit) = limit {
|
|
||||||
batches = if query.reverse.unwrap_or_default() {
|
batches = if query.reverse.unwrap_or_default() {
|
||||||
batches.into_iter().take(*limit as usize).collect()
|
batches.into_iter().take(*limit).collect()
|
||||||
} else {
|
} else {
|
||||||
batches.into_iter().rev().take(*limit as usize).collect()
|
batches.into_iter().rev().take(*limit).collect()
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
}
|
}
|
||||||
@@ -602,11 +600,8 @@ impl Queue {
|
|||||||
Box::new(batches.into_iter().rev()) as Box<dyn Iterator<Item = u32>>
|
Box::new(batches.into_iter().rev()) as Box<dyn Iterator<Item = u32>>
|
||||||
};
|
};
|
||||||
|
|
||||||
let batches = self.batches.get_existing_batches(
|
let batches =
|
||||||
rtxn,
|
self.batches.get_existing_batches(rtxn, batches.take(query.limit), processing)?;
|
||||||
batches.take(query.limit.unwrap_or(u32::MAX) as usize),
|
|
||||||
processing,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
Ok((batches, total))
|
Ok((batches, total))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,21 +28,21 @@ fn query_batches_from_and_limit() {
|
|||||||
|
|
||||||
let proc = index_scheduler.processing_tasks.read().unwrap().clone();
|
let proc = index_scheduler.processing_tasks.read().unwrap().clone();
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
let rtxn = index_scheduler.env.read_txn().unwrap();
|
||||||
let query = Query { limit: Some(0), ..Default::default() };
|
let query = Query { limit: 0, ..Default::default() };
|
||||||
let (batches, _) = index_scheduler
|
let (batches, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&batches), @"[]");
|
snapshot!(snapshot_bitmap(&batches), @"[]");
|
||||||
|
|
||||||
let query = Query { limit: Some(1), ..Default::default() };
|
let query = Query { limit: 1, ..Default::default() };
|
||||||
let (batches, _) = index_scheduler
|
let (batches, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&batches), @"[2,]");
|
snapshot!(snapshot_bitmap(&batches), @"[2,]");
|
||||||
|
|
||||||
let query = Query { limit: Some(2), ..Default::default() };
|
let query = Query { limit: 2, ..Default::default() };
|
||||||
let (batches, _) = index_scheduler
|
let (batches, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
||||||
@@ -63,14 +63,14 @@ fn query_batches_from_and_limit() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&batches), @"[0,1,2,]");
|
snapshot!(snapshot_bitmap(&batches), @"[0,1,2,]");
|
||||||
|
|
||||||
let query = Query { from: Some(1), limit: Some(1), ..Default::default() };
|
let query = Query { from: Some(1), limit: 1, ..Default::default() };
|
||||||
let (batches, _) = index_scheduler
|
let (batches, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&batches), @"[1,]");
|
snapshot!(snapshot_bitmap(&batches), @"[1,]");
|
||||||
|
|
||||||
let query = Query { from: Some(1), limit: Some(2), ..Default::default() };
|
let query = Query { from: Some(1), limit: 2, ..Default::default() };
|
||||||
let (batches, _) = index_scheduler
|
let (batches, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
.get_batch_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &proc)
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ use crate::{Error, IndexSchedulerOptions, Result, TaskId};
|
|||||||
|
|
||||||
/// The number of database used by queue itself
|
/// The number of database used by queue itself
|
||||||
const NUMBER_OF_DATABASES: u32 = 1;
|
const NUMBER_OF_DATABASES: u32 = 1;
|
||||||
|
/// The default limit for pagination
|
||||||
|
const DEFAULT_LIMIT: usize = 20;
|
||||||
|
|
||||||
/// Database const names for the `IndexScheduler`.
|
/// Database const names for the `IndexScheduler`.
|
||||||
mod db_name {
|
mod db_name {
|
||||||
pub const BATCH_TO_TASKS_MAPPING: &str = "batch-to-tasks-mapping";
|
pub const BATCH_TO_TASKS_MAPPING: &str = "batch-to-tasks-mapping";
|
||||||
@@ -40,11 +43,11 @@ mod db_name {
|
|||||||
///
|
///
|
||||||
/// An empty/default query (where each field is set to `None`) matches all tasks.
|
/// An empty/default query (where each field is set to `None`) matches all tasks.
|
||||||
/// Each non-null field restricts the set of tasks further.
|
/// Each non-null field restricts the set of tasks further.
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Query {
|
pub struct Query {
|
||||||
/// The maximum number of tasks to be matched
|
/// The maximum number of tasks to be matched. Defaults to 20.
|
||||||
pub limit: Option<u32>,
|
pub limit: usize,
|
||||||
/// The minimum [task id](`meilisearch_types::tasks::Task::uid`) to be matched
|
/// The minimum [task id](`meilisearch_types::tasks::Task::uid`) to be matched. Defaults to 0.
|
||||||
pub from: Option<u32>,
|
pub from: Option<u32>,
|
||||||
/// The order used to return the tasks. By default the newest tasks are returned first and the boolean is `false`.
|
/// The order used to return the tasks. By default the newest tasks are returned first and the boolean is `false`.
|
||||||
pub reverse: Option<bool>,
|
pub reverse: Option<bool>,
|
||||||
@@ -83,32 +86,29 @@ pub struct Query {
|
|||||||
pub after_finished_at: Option<OffsetDateTime>,
|
pub after_finished_at: Option<OffsetDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Query {
|
impl Default for Query {
|
||||||
/// Return `true` if every field of the query is set to `None`, such that the query
|
fn default() -> Self {
|
||||||
/// matches all tasks.
|
Self {
|
||||||
pub fn is_empty(&self) -> bool {
|
limit: DEFAULT_LIMIT,
|
||||||
matches!(
|
from: Default::default(),
|
||||||
self,
|
reverse: Default::default(),
|
||||||
Query {
|
uids: Default::default(),
|
||||||
limit: None,
|
batch_uids: Default::default(),
|
||||||
from: None,
|
statuses: Default::default(),
|
||||||
reverse: None,
|
types: Default::default(),
|
||||||
uids: None,
|
index_uids: Default::default(),
|
||||||
batch_uids: None,
|
canceled_by: Default::default(),
|
||||||
statuses: None,
|
before_enqueued_at: Default::default(),
|
||||||
types: None,
|
after_enqueued_at: Default::default(),
|
||||||
index_uids: None,
|
before_started_at: Default::default(),
|
||||||
canceled_by: None,
|
after_started_at: Default::default(),
|
||||||
before_enqueued_at: None,
|
before_finished_at: Default::default(),
|
||||||
after_enqueued_at: None,
|
after_finished_at: Default::default(),
|
||||||
before_started_at: None,
|
|
||||||
after_started_at: None,
|
|
||||||
before_finished_at: None,
|
|
||||||
after_finished_at: None,
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Query {
|
||||||
/// Add an [index id](meilisearch_types::tasks::Task::index_uid) to the list of permitted indexes.
|
/// Add an [index id](meilisearch_types::tasks::Task::index_uid) to the list of permitted indexes.
|
||||||
pub fn with_index(self, index_uid: String) -> Self {
|
pub fn with_index(self, index_uid: String) -> Self {
|
||||||
let mut index_vec = self.index_uids.unwrap_or_default();
|
let mut index_vec = self.index_uids.unwrap_or_default();
|
||||||
@@ -119,7 +119,7 @@ impl Query {
|
|||||||
// Removes the `from` and `limit` restrictions from the query.
|
// Removes the `from` and `limit` restrictions from the query.
|
||||||
// Useful to get the total number of tasks matching a filter.
|
// Useful to get the total number of tasks matching a filter.
|
||||||
pub fn without_limits(self) -> Self {
|
pub fn without_limits(self) -> Self {
|
||||||
Query { limit: None, from: None, ..self }
|
Query { limit: usize::MAX, from: None, ..self }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -465,13 +465,11 @@ impl Queue {
|
|||||||
*before_finished_at,
|
*before_finished_at,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(limit) = limit {
|
|
||||||
tasks = if query.reverse.unwrap_or_default() {
|
tasks = if query.reverse.unwrap_or_default() {
|
||||||
tasks.into_iter().take(*limit as usize).collect()
|
tasks.into_iter().take(*limit).collect()
|
||||||
} else {
|
} else {
|
||||||
tasks.into_iter().rev().take(*limit as usize).collect()
|
tasks.into_iter().rev().take(*limit).collect()
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
Ok(tasks)
|
Ok(tasks)
|
||||||
}
|
}
|
||||||
@@ -529,9 +527,7 @@ impl Queue {
|
|||||||
} else {
|
} else {
|
||||||
Box::new(tasks.into_iter().rev()) as Box<dyn Iterator<Item = u32>>
|
Box::new(tasks.into_iter().rev()) as Box<dyn Iterator<Item = u32>>
|
||||||
};
|
};
|
||||||
let tasks = self
|
let tasks = self.tasks.get_existing_tasks(rtxn, tasks.take(query.limit))?;
|
||||||
.tasks
|
|
||||||
.get_existing_tasks(rtxn, tasks.take(query.limit.unwrap_or(u32::MAX) as usize))?;
|
|
||||||
|
|
||||||
let ProcessingTasks { batch, processing, progress: _ } = processing_tasks;
|
let ProcessingTasks { batch, processing, progress: _ } = processing_tasks;
|
||||||
|
|
||||||
|
|||||||
@@ -28,21 +28,21 @@ fn query_tasks_from_and_limit() {
|
|||||||
|
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
let rtxn = index_scheduler.env.read_txn().unwrap();
|
||||||
let processing = index_scheduler.processing_tasks.read().unwrap();
|
let processing = index_scheduler.processing_tasks.read().unwrap();
|
||||||
let query = Query { limit: Some(0), ..Default::default() };
|
let query = Query { limit: 0, ..Default::default() };
|
||||||
let (tasks, _) = index_scheduler
|
let (tasks, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&tasks), @"[]");
|
snapshot!(snapshot_bitmap(&tasks), @"[]");
|
||||||
|
|
||||||
let query = Query { limit: Some(1), ..Default::default() };
|
let query = Query { limit: 1, ..Default::default() };
|
||||||
let (tasks, _) = index_scheduler
|
let (tasks, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&tasks), @"[2,]");
|
snapshot!(snapshot_bitmap(&tasks), @"[2,]");
|
||||||
|
|
||||||
let query = Query { limit: Some(2), ..Default::default() };
|
let query = Query { limit: 2, ..Default::default() };
|
||||||
let (tasks, _) = index_scheduler
|
let (tasks, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
||||||
@@ -63,14 +63,14 @@ fn query_tasks_from_and_limit() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&tasks), @"[0,1,2,]");
|
snapshot!(snapshot_bitmap(&tasks), @"[0,1,2,]");
|
||||||
|
|
||||||
let query = Query { from: Some(1), limit: Some(1), ..Default::default() };
|
let query = Query { from: Some(1), limit: 1, ..Default::default() };
|
||||||
let (tasks, _) = index_scheduler
|
let (tasks, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
snapshot!(snapshot_bitmap(&tasks), @"[1,]");
|
snapshot!(snapshot_bitmap(&tasks), @"[1,]");
|
||||||
|
|
||||||
let query = Query { from: Some(1), limit: Some(2), ..Default::default() };
|
let query = Query { from: Some(1), limit: 2, ..Default::default() };
|
||||||
let (tasks, _) = index_scheduler
|
let (tasks, _) = index_scheduler
|
||||||
.queue
|
.queue
|
||||||
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
.get_task_ids_from_authorized_indexes(&rtxn, &query, &AuthFilter::default(), &processing)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source: crates/index-scheduler/src/scheduler/test.rs
|
|||||||
[]
|
[]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, status: enqueued, details: { settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, foreign_keys: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> } }, kind: SettingsUpdate { index_uid: "doggos", new_settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, foreign_keys: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> }, is_deletion: false, allow_index_creation: true }}
|
0 {uid: 0, status: enqueued, details: { settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> } }, kind: SettingsUpdate { index_uid: "doggos", new_settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> }, is_deletion: false, allow_index_creation: true }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Status:
|
### Status:
|
||||||
enqueued [0,]
|
enqueued [0,]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source: crates/index-scheduler/src/scheduler/test.rs
|
|||||||
[]
|
[]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, batch_uid: 0, status: succeeded, details: { settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, foreign_keys: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> } }, kind: SettingsUpdate { index_uid: "doggos", new_settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, foreign_keys: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> }, is_deletion: false, allow_index_creation: true }}
|
0 {uid: 0, batch_uid: 0, status: succeeded, details: { settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> } }, kind: SettingsUpdate { index_uid: "doggos", new_settings: Settings { displayed_attributes: WildcardSetting(NotSet), searchable_attributes: WildcardSetting(NotSet), filterable_attributes: NotSet, sortable_attributes: NotSet, ranking_rules: NotSet, stop_words: NotSet, non_separator_tokens: NotSet, separator_tokens: NotSet, dictionary: NotSet, synonyms: NotSet, distinct_attribute: NotSet, proximity_precision: NotSet, typo_tolerance: NotSet, faceting: NotSet, pagination: NotSet, embedders: Set({"default": Set(EmbeddingSettings { source: Set(Rest), model: NotSet, revision: NotSet, pooling: NotSet, api_key: Set("My super secret"), dimensions: Set(4), binary_quantized: NotSet, document_template: NotSet, document_template_max_bytes: NotSet, url: Set("http://localhost:7777"), indexing_fragments: NotSet, search_fragments: NotSet, request: Set(String("{{text}}")), response: Set(String("{{embedding}}")), headers: NotSet, search_embedder: NotSet, indexing_embedder: NotSet, distribution: NotSet })}), search_cutoff_ms: NotSet, localized_attributes: NotSet, facet_search: NotSet, prefix_search: NotSet, chat: NotSet, vector_store: NotSet, _kind: PhantomData<meilisearch_types::settings::Unchecked> }, is_deletion: false, allow_index_creation: true }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Status:
|
### Status:
|
||||||
enqueued []
|
enqueued []
|
||||||
|
|||||||
@@ -327,7 +327,6 @@ InvalidSettingsFacetSearch , InvalidRequest , BAD_REQU
|
|||||||
InvalidSettingsPrefixSearch , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsPrefixSearch , InvalidRequest , BAD_REQUEST ;
|
||||||
InvalidSettingsFaceting , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsFaceting , InvalidRequest , BAD_REQUEST ;
|
||||||
InvalidSettingsFilterableAttributes , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsFilterableAttributes , InvalidRequest , BAD_REQUEST ;
|
||||||
InvalidSettingsForeignKeys , InvalidRequest , BAD_REQUEST ;
|
|
||||||
InvalidSettingsPagination , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsPagination , InvalidRequest , BAD_REQUEST ;
|
||||||
InvalidSettingsSearchCutoffMs , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsSearchCutoffMs , InvalidRequest , BAD_REQUEST ;
|
||||||
InvalidSettingsEmbedders , InvalidRequest , BAD_REQUEST ;
|
InvalidSettingsEmbedders , InvalidRequest , BAD_REQUEST ;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ pub struct RuntimeTogglableFeatures {
|
|||||||
pub chat_completions: bool,
|
pub chat_completions: bool,
|
||||||
pub multimodal: bool,
|
pub multimodal: bool,
|
||||||
pub vector_store_setting: bool,
|
pub vector_store_setting: bool,
|
||||||
pub foreign_keys: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Copy)]
|
#[derive(Default, Debug, Clone, Copy)]
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ pub use milli::update::ChatSettings;
|
|||||||
use milli::update::Setting;
|
use milli::update::Setting;
|
||||||
use milli::vector::db::IndexEmbeddingConfig;
|
use milli::vector::db::IndexEmbeddingConfig;
|
||||||
use milli::vector::VectorStoreBackend;
|
use milli::vector::VectorStoreBackend;
|
||||||
use milli::{
|
use milli::{Criterion, CriterionError, FilterableAttributesRule, Index, DEFAULT_VALUES_PER_FACET};
|
||||||
Criterion, CriterionError, FilterableAttributesRule, ForeignKey, Index,
|
|
||||||
DEFAULT_VALUES_PER_FACET,
|
|
||||||
};
|
|
||||||
use serde::{Deserialize, Serialize, Serializer};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
|
|
||||||
@@ -224,12 +221,6 @@ pub struct Settings<T> {
|
|||||||
#[schema(value_type = Option<Vec<String>>, example = json!(["release_date"]))]
|
#[schema(value_type = Option<Vec<String>>, example = json!(["release_date"]))]
|
||||||
pub sortable_attributes: Setting<BTreeSet<String>>,
|
pub sortable_attributes: Setting<BTreeSet<String>>,
|
||||||
|
|
||||||
/// Foreign keys to use for cross-index filtering search.
|
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidSettingsForeignKeys>)]
|
|
||||||
#[schema(value_type = Option<Vec<ForeignKey>>, example = json!([{"foreignIndexUid": "products", "fieldName": "productId"}]))]
|
|
||||||
pub foreign_keys: Setting<Vec<ForeignKey>>,
|
|
||||||
|
|
||||||
/// List of ranking rules sorted by order of importance. The order is customizable.
|
/// List of ranking rules sorted by order of importance. The order is customizable.
|
||||||
/// [A list of ordered built-in ranking rules](https://www.meilisearch.com/docs/learn/relevancy/relevancy).
|
/// [A list of ordered built-in ranking rules](https://www.meilisearch.com/docs/learn/relevancy/relevancy).
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
@@ -385,7 +376,6 @@ impl Settings<Checked> {
|
|||||||
displayed_attributes: Setting::Reset.into(),
|
displayed_attributes: Setting::Reset.into(),
|
||||||
searchable_attributes: Setting::Reset.into(),
|
searchable_attributes: Setting::Reset.into(),
|
||||||
filterable_attributes: Setting::Reset,
|
filterable_attributes: Setting::Reset,
|
||||||
foreign_keys: Setting::Reset,
|
|
||||||
sortable_attributes: Setting::Reset,
|
sortable_attributes: Setting::Reset,
|
||||||
ranking_rules: Setting::Reset,
|
ranking_rules: Setting::Reset,
|
||||||
stop_words: Setting::Reset,
|
stop_words: Setting::Reset,
|
||||||
@@ -414,7 +404,6 @@ impl Settings<Checked> {
|
|||||||
displayed_attributes,
|
displayed_attributes,
|
||||||
searchable_attributes,
|
searchable_attributes,
|
||||||
filterable_attributes,
|
filterable_attributes,
|
||||||
foreign_keys,
|
|
||||||
sortable_attributes,
|
sortable_attributes,
|
||||||
ranking_rules,
|
ranking_rules,
|
||||||
stop_words,
|
stop_words,
|
||||||
@@ -442,7 +431,6 @@ impl Settings<Checked> {
|
|||||||
searchable_attributes,
|
searchable_attributes,
|
||||||
filterable_attributes,
|
filterable_attributes,
|
||||||
sortable_attributes,
|
sortable_attributes,
|
||||||
foreign_keys,
|
|
||||||
ranking_rules,
|
ranking_rules,
|
||||||
stop_words,
|
stop_words,
|
||||||
non_separator_tokens,
|
non_separator_tokens,
|
||||||
@@ -494,7 +482,6 @@ impl Settings<Unchecked> {
|
|||||||
displayed_attributes: displayed_attributes.into(),
|
displayed_attributes: displayed_attributes.into(),
|
||||||
searchable_attributes: searchable_attributes.into(),
|
searchable_attributes: searchable_attributes.into(),
|
||||||
filterable_attributes: self.filterable_attributes,
|
filterable_attributes: self.filterable_attributes,
|
||||||
foreign_keys: self.foreign_keys,
|
|
||||||
sortable_attributes: self.sortable_attributes,
|
sortable_attributes: self.sortable_attributes,
|
||||||
ranking_rules: self.ranking_rules,
|
ranking_rules: self.ranking_rules,
|
||||||
stop_words: self.stop_words,
|
stop_words: self.stop_words,
|
||||||
@@ -556,7 +543,6 @@ impl Settings<Unchecked> {
|
|||||||
.sortable_attributes
|
.sortable_attributes
|
||||||
.clone()
|
.clone()
|
||||||
.or(self.sortable_attributes.clone()),
|
.or(self.sortable_attributes.clone()),
|
||||||
foreign_keys: other.foreign_keys.clone().or(self.foreign_keys.clone()),
|
|
||||||
ranking_rules: other.ranking_rules.clone().or(self.ranking_rules.clone()),
|
ranking_rules: other.ranking_rules.clone().or(self.ranking_rules.clone()),
|
||||||
stop_words: other.stop_words.clone().or(self.stop_words.clone()),
|
stop_words: other.stop_words.clone().or(self.stop_words.clone()),
|
||||||
non_separator_tokens: other
|
non_separator_tokens: other
|
||||||
@@ -618,7 +604,6 @@ pub fn apply_settings_to_builder(
|
|||||||
searchable_attributes,
|
searchable_attributes,
|
||||||
filterable_attributes,
|
filterable_attributes,
|
||||||
sortable_attributes,
|
sortable_attributes,
|
||||||
foreign_keys,
|
|
||||||
ranking_rules,
|
ranking_rules,
|
||||||
stop_words,
|
stop_words,
|
||||||
non_separator_tokens,
|
non_separator_tokens,
|
||||||
@@ -666,12 +651,6 @@ pub fn apply_settings_to_builder(
|
|||||||
Setting::NotSet => (),
|
Setting::NotSet => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
match foreign_keys {
|
|
||||||
Setting::Set(ref keys) => builder.set_foreign_keys(keys.clone().into_iter().collect()),
|
|
||||||
Setting::Reset => builder.reset_foreign_keys(),
|
|
||||||
Setting::NotSet => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
match ranking_rules {
|
match ranking_rules {
|
||||||
Setting::Set(ref criteria) => {
|
Setting::Set(ref criteria) => {
|
||||||
builder.set_criteria(criteria.iter().map(|c| c.clone().into()).collect())
|
builder.set_criteria(criteria.iter().map(|c| c.clone().into()).collect())
|
||||||
@@ -889,8 +868,6 @@ pub fn settings(
|
|||||||
|
|
||||||
let sortable_attributes = index.sortable_fields(rtxn)?.into_iter().collect();
|
let sortable_attributes = index.sortable_fields(rtxn)?.into_iter().collect();
|
||||||
|
|
||||||
let foreign_keys = index.foreign_keys(rtxn)?.into_iter().collect();
|
|
||||||
|
|
||||||
let criteria = index.criteria(rtxn)?;
|
let criteria = index.criteria(rtxn)?;
|
||||||
|
|
||||||
let stop_words = index
|
let stop_words = index
|
||||||
@@ -988,7 +965,6 @@ pub fn settings(
|
|||||||
.into(),
|
.into(),
|
||||||
filterable_attributes: Setting::Set(filterable_attributes),
|
filterable_attributes: Setting::Set(filterable_attributes),
|
||||||
sortable_attributes: Setting::Set(sortable_attributes),
|
sortable_attributes: Setting::Set(sortable_attributes),
|
||||||
foreign_keys: Setting::Set(foreign_keys),
|
|
||||||
ranking_rules: Setting::Set(criteria.iter().map(|c| c.clone().into()).collect()),
|
ranking_rules: Setting::Set(criteria.iter().map(|c| c.clone().into()).collect()),
|
||||||
stop_words: Setting::Set(stop_words),
|
stop_words: Setting::Set(stop_words),
|
||||||
non_separator_tokens: Setting::Set(non_separator_tokens),
|
non_separator_tokens: Setting::Set(non_separator_tokens),
|
||||||
@@ -1231,7 +1207,6 @@ pub(crate) mod test {
|
|||||||
searchable_attributes: Setting::Set(vec![String::from("hello")]).into(),
|
searchable_attributes: Setting::Set(vec![String::from("hello")]).into(),
|
||||||
filterable_attributes: Setting::NotSet,
|
filterable_attributes: Setting::NotSet,
|
||||||
sortable_attributes: Setting::NotSet,
|
sortable_attributes: Setting::NotSet,
|
||||||
foreign_keys: Setting::NotSet,
|
|
||||||
ranking_rules: Setting::NotSet,
|
ranking_rules: Setting::NotSet,
|
||||||
stop_words: Setting::NotSet,
|
stop_words: Setting::NotSet,
|
||||||
non_separator_tokens: Setting::NotSet,
|
non_separator_tokens: Setting::NotSet,
|
||||||
@@ -1265,7 +1240,6 @@ pub(crate) mod test {
|
|||||||
.into(),
|
.into(),
|
||||||
filterable_attributes: Setting::NotSet,
|
filterable_attributes: Setting::NotSet,
|
||||||
sortable_attributes: Setting::NotSet,
|
sortable_attributes: Setting::NotSet,
|
||||||
foreign_keys: Setting::NotSet,
|
|
||||||
ranking_rules: Setting::NotSet,
|
ranking_rules: Setting::NotSet,
|
||||||
stop_words: Setting::NotSet,
|
stop_words: Setting::NotSet,
|
||||||
non_separator_tokens: Setting::NotSet,
|
non_separator_tokens: Setting::NotSet,
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ struct Infos {
|
|||||||
experimental_no_edition_2024_for_prefix_post_processing: bool,
|
experimental_no_edition_2024_for_prefix_post_processing: bool,
|
||||||
experimental_no_edition_2024_for_facet_post_processing: bool,
|
experimental_no_edition_2024_for_facet_post_processing: bool,
|
||||||
experimental_vector_store_setting: bool,
|
experimental_vector_store_setting: bool,
|
||||||
experimental_foreign_keys: bool,
|
|
||||||
experimental_personalization: bool,
|
experimental_personalization: bool,
|
||||||
gpu_enabled: bool,
|
gpu_enabled: bool,
|
||||||
db_path: bool,
|
db_path: bool,
|
||||||
@@ -318,7 +317,6 @@ impl Infos {
|
|||||||
chat_completions,
|
chat_completions,
|
||||||
multimodal,
|
multimodal,
|
||||||
vector_store_setting,
|
vector_store_setting,
|
||||||
foreign_keys,
|
|
||||||
} = features;
|
} = features;
|
||||||
|
|
||||||
// We're going to override every sensible information.
|
// We're going to override every sensible information.
|
||||||
@@ -345,7 +343,6 @@ impl Infos {
|
|||||||
experimental_no_snapshot_compaction,
|
experimental_no_snapshot_compaction,
|
||||||
experimental_no_edition_2024_for_dumps,
|
experimental_no_edition_2024_for_dumps,
|
||||||
experimental_vector_store_setting: vector_store_setting,
|
experimental_vector_store_setting: vector_store_setting,
|
||||||
experimental_foreign_keys: foreign_keys,
|
|
||||||
gpu_enabled: meilisearch_types::milli::vector::is_cuda_enabled(),
|
gpu_enabled: meilisearch_types::milli::vector::is_cuda_enabled(),
|
||||||
db_path: db_path != Path::new("./data.ms"),
|
db_path: db_path != Path::new("./data.ms"),
|
||||||
import_dump: import_dump.is_some(),
|
import_dump: import_dump.is_some(),
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||||||
chat_completions: Some(false),
|
chat_completions: Some(false),
|
||||||
multimodal: Some(false),
|
multimodal: Some(false),
|
||||||
vector_store_setting: Some(false),
|
vector_store_setting: Some(false),
|
||||||
foreign_keys: Some(false),
|
|
||||||
})),
|
})),
|
||||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||||
{
|
{
|
||||||
@@ -107,8 +106,6 @@ pub struct RuntimeTogglableFeatures {
|
|||||||
pub multimodal: Option<bool>,
|
pub multimodal: Option<bool>,
|
||||||
#[deserr(default)]
|
#[deserr(default)]
|
||||||
pub vector_store_setting: Option<bool>,
|
pub vector_store_setting: Option<bool>,
|
||||||
#[deserr(default)]
|
|
||||||
pub foreign_keys: Option<bool>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
|
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
|
||||||
@@ -124,7 +121,6 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
|||||||
chat_completions,
|
chat_completions,
|
||||||
multimodal,
|
multimodal,
|
||||||
vector_store_setting,
|
vector_store_setting,
|
||||||
foreign_keys,
|
|
||||||
} = value;
|
} = value;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@@ -138,7 +134,6 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
|||||||
chat_completions: Some(chat_completions),
|
chat_completions: Some(chat_completions),
|
||||||
multimodal: Some(multimodal),
|
multimodal: Some(multimodal),
|
||||||
vector_store_setting: Some(vector_store_setting),
|
vector_store_setting: Some(vector_store_setting),
|
||||||
foreign_keys: Some(foreign_keys),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +150,6 @@ pub struct PatchExperimentalFeatureAnalytics {
|
|||||||
chat_completions: bool,
|
chat_completions: bool,
|
||||||
multimodal: bool,
|
multimodal: bool,
|
||||||
vector_store_setting: bool,
|
vector_store_setting: bool,
|
||||||
foreign_keys: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Aggregate for PatchExperimentalFeatureAnalytics {
|
impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||||
@@ -175,7 +169,6 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
|||||||
chat_completions: new.chat_completions,
|
chat_completions: new.chat_completions,
|
||||||
multimodal: new.multimodal,
|
multimodal: new.multimodal,
|
||||||
vector_store_setting: new.vector_store_setting,
|
vector_store_setting: new.vector_store_setting,
|
||||||
foreign_keys: new.foreign_keys,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +197,6 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
|||||||
chat_completions: Some(false),
|
chat_completions: Some(false),
|
||||||
multimodal: Some(false),
|
multimodal: Some(false),
|
||||||
vector_store_setting: Some(false),
|
vector_store_setting: Some(false),
|
||||||
foreign_keys: Some(false),
|
|
||||||
})),
|
})),
|
||||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||||
{
|
{
|
||||||
@@ -252,7 +244,6 @@ async fn patch_features(
|
|||||||
.0
|
.0
|
||||||
.vector_store_setting
|
.vector_store_setting
|
||||||
.unwrap_or(old_features.vector_store_setting),
|
.unwrap_or(old_features.vector_store_setting),
|
||||||
foreign_keys: new_features.0.foreign_keys.unwrap_or(old_features.foreign_keys),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
|
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
|
||||||
@@ -269,7 +260,6 @@ async fn patch_features(
|
|||||||
chat_completions,
|
chat_completions,
|
||||||
multimodal,
|
multimodal,
|
||||||
vector_store_setting,
|
vector_store_setting,
|
||||||
foreign_keys,
|
|
||||||
} = new_features;
|
} = new_features;
|
||||||
|
|
||||||
analytics.publish(
|
analytics.publish(
|
||||||
@@ -284,7 +274,6 @@ async fn patch_features(
|
|||||||
chat_completions,
|
chat_completions,
|
||||||
multimodal,
|
multimodal,
|
||||||
vector_store_setting,
|
vector_store_setting,
|
||||||
foreign_keys,
|
|
||||||
},
|
},
|
||||||
&req,
|
&req,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -531,17 +531,6 @@ make_setting_routes!(
|
|||||||
camelcase_attr: "vectorStore",
|
camelcase_attr: "vectorStore",
|
||||||
analytics: VectorStoreAnalytics
|
analytics: VectorStoreAnalytics
|
||||||
},
|
},
|
||||||
{
|
|
||||||
route: "/foreign-keys",
|
|
||||||
update_verb: put,
|
|
||||||
value_type: Vec<meilisearch_types::milli::ForeignKey>,
|
|
||||||
err_type: meilisearch_types::deserr::DeserrJsonError<
|
|
||||||
meilisearch_types::error::deserr_codes::InvalidSettingsForeignKeys,
|
|
||||||
>,
|
|
||||||
attr: foreign_keys,
|
|
||||||
camelcase_attr: "foreignKeys",
|
|
||||||
analytics: ForeignKeysAnalytics
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
@@ -606,7 +595,6 @@ pub async fn update_all(
|
|||||||
filterable_attributes: FilterableAttributesAnalytics::new(
|
filterable_attributes: FilterableAttributesAnalytics::new(
|
||||||
new_settings.filterable_attributes.as_ref().set(),
|
new_settings.filterable_attributes.as_ref().set(),
|
||||||
),
|
),
|
||||||
foreign_keys: ForeignKeysAnalytics::new(new_settings.foreign_keys.as_ref().set()),
|
|
||||||
distinct_attribute: DistinctAttributeAnalytics::new(
|
distinct_attribute: DistinctAttributeAnalytics::new(
|
||||||
new_settings.distinct_attribute.as_ref().set(),
|
new_settings.distinct_attribute.as_ref().set(),
|
||||||
),
|
),
|
||||||
@@ -700,10 +688,6 @@ pub async fn get_all(
|
|||||||
new_settings.vector_store = Setting::NotSet;
|
new_settings.vector_store = Setting::NotSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
if features.check_foreign_keys_setting("showing index `foreignKeys` settings").is_err() {
|
|
||||||
new_settings.foreign_keys = Setting::NotSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
debug!(returns = ?new_settings, "Get all settings");
|
debug!(returns = ?new_settings, "Get all settings");
|
||||||
Ok(HttpResponse::Ok().json(new_settings))
|
Ok(HttpResponse::Ok().json(new_settings))
|
||||||
}
|
}
|
||||||
@@ -809,9 +793,5 @@ fn validate_settings(
|
|||||||
features.check_vector_store_setting("setting `vectorStore` in the index settings")?;
|
features.check_vector_store_setting("setting `vectorStore` in the index settings")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Setting::Set(_) = &settings.foreign_keys {
|
|
||||||
features.check_foreign_keys_setting("setting `foreignKeys` in the index settings")?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(settings.validate()?)
|
Ok(settings.validate()?)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use meilisearch_types::facet_values_sort::FacetValuesSort;
|
|||||||
use meilisearch_types::locales::{Locale, LocalizedAttributesRuleView};
|
use meilisearch_types::locales::{Locale, LocalizedAttributesRuleView};
|
||||||
use meilisearch_types::milli::update::Setting;
|
use meilisearch_types::milli::update::Setting;
|
||||||
use meilisearch_types::milli::vector::VectorStoreBackend;
|
use meilisearch_types::milli::vector::VectorStoreBackend;
|
||||||
use meilisearch_types::milli::{FilterableAttributesRule, ForeignKey};
|
use meilisearch_types::milli::FilterableAttributesRule;
|
||||||
use meilisearch_types::settings::{
|
use meilisearch_types::settings::{
|
||||||
ChatSettings, FacetingSettings, PaginationSettings, PrefixSearchSettings,
|
ChatSettings, FacetingSettings, PaginationSettings, PrefixSearchSettings,
|
||||||
ProximityPrecisionView, RankingRuleView, SettingEmbeddingSettings, TypoSettings,
|
ProximityPrecisionView, RankingRuleView, SettingEmbeddingSettings, TypoSettings,
|
||||||
@@ -25,7 +25,6 @@ pub struct SettingsAnalytics {
|
|||||||
pub displayed_attributes: DisplayedAttributesAnalytics,
|
pub displayed_attributes: DisplayedAttributesAnalytics,
|
||||||
pub sortable_attributes: SortableAttributesAnalytics,
|
pub sortable_attributes: SortableAttributesAnalytics,
|
||||||
pub filterable_attributes: FilterableAttributesAnalytics,
|
pub filterable_attributes: FilterableAttributesAnalytics,
|
||||||
pub foreign_keys: ForeignKeysAnalytics,
|
|
||||||
pub distinct_attribute: DistinctAttributeAnalytics,
|
pub distinct_attribute: DistinctAttributeAnalytics,
|
||||||
pub proximity_precision: ProximityPrecisionAnalytics,
|
pub proximity_precision: ProximityPrecisionAnalytics,
|
||||||
pub typo_tolerance: TypoToleranceAnalytics,
|
pub typo_tolerance: TypoToleranceAnalytics,
|
||||||
@@ -99,10 +98,6 @@ impl Aggregate for SettingsAnalytics {
|
|||||||
.has_patterns
|
.has_patterns
|
||||||
.or(self.filterable_attributes.has_patterns),
|
.or(self.filterable_attributes.has_patterns),
|
||||||
},
|
},
|
||||||
foreign_keys: ForeignKeysAnalytics {
|
|
||||||
set: new.foreign_keys.set | self.foreign_keys.set,
|
|
||||||
total: new.foreign_keys.total.or(self.foreign_keys.total),
|
|
||||||
},
|
|
||||||
distinct_attribute: DistinctAttributeAnalytics {
|
distinct_attribute: DistinctAttributeAnalytics {
|
||||||
set: self.distinct_attribute.set | new.distinct_attribute.set,
|
set: self.distinct_attribute.set | new.distinct_attribute.set,
|
||||||
},
|
},
|
||||||
@@ -367,22 +362,6 @@ impl FilterableAttributesAnalytics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Default)]
|
|
||||||
pub struct ForeignKeysAnalytics {
|
|
||||||
pub set: bool,
|
|
||||||
pub total: Option<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ForeignKeysAnalytics {
|
|
||||||
pub fn new(settings: Option<&Vec<ForeignKey>>) -> Self {
|
|
||||||
Self { set: settings.is_some(), total: settings.as_ref().map(|s| s.len()) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn into_settings(self) -> SettingsAnalytics {
|
|
||||||
SettingsAnalytics { foreign_keys: self, ..Default::default() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Default)]
|
#[derive(Serialize, Default)]
|
||||||
pub struct DistinctAttributeAnalytics {
|
pub struct DistinctAttributeAnalytics {
|
||||||
pub set: bool,
|
pub set: bool,
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ pub async fn get_metrics(
|
|||||||
// Fetch the finished batches...
|
// Fetch the finished batches...
|
||||||
&Query {
|
&Query {
|
||||||
statuses: Some(vec![Status::Succeeded, Status::Failed]),
|
statuses: Some(vec![Status::Succeeded, Status::Failed]),
|
||||||
limit: Some(1),
|
limit: 1,
|
||||||
..Query::default()
|
..Query::default()
|
||||||
},
|
},
|
||||||
auth_filters,
|
auth_filters,
|
||||||
@@ -214,7 +214,7 @@ pub async fn get_metrics(
|
|||||||
let task_queue_latency_seconds = index_scheduler
|
let task_queue_latency_seconds = index_scheduler
|
||||||
.get_tasks_from_authorized_indexes(
|
.get_tasks_from_authorized_indexes(
|
||||||
&Query {
|
&Query {
|
||||||
limit: Some(1),
|
limit: 1,
|
||||||
reverse: Some(true),
|
reverse: Some(true),
|
||||||
statuses: Some(vec![Status::Enqueued, Status::Processing]),
|
statuses: Some(vec![Status::Enqueued, Status::Processing]),
|
||||||
..Query::default()
|
..Query::default()
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ pub struct TasksFilterQuery {
|
|||||||
impl TasksFilterQuery {
|
impl TasksFilterQuery {
|
||||||
pub(crate) fn into_query(self) -> Query {
|
pub(crate) fn into_query(self) -> Query {
|
||||||
Query {
|
Query {
|
||||||
limit: Some(self.limit.0),
|
limit: self.limit.0 as usize,
|
||||||
from: self.from.as_deref().copied(),
|
from: self.from.as_deref().copied(),
|
||||||
reverse: self.reverse.as_deref().copied(),
|
reverse: self.reverse.as_deref().copied(),
|
||||||
batch_uids: self.batch_uids.merge_star_and_none(),
|
batch_uids: self.batch_uids.merge_star_and_none(),
|
||||||
@@ -225,7 +225,8 @@ pub struct TaskDeletionOrCancelationQuery {
|
|||||||
impl TaskDeletionOrCancelationQuery {
|
impl TaskDeletionOrCancelationQuery {
|
||||||
fn into_query(self) -> Query {
|
fn into_query(self) -> Query {
|
||||||
Query {
|
Query {
|
||||||
limit: None,
|
// We want to delete all tasks that match the given filters
|
||||||
|
limit: usize::MAX,
|
||||||
from: None,
|
from: None,
|
||||||
reverse: None,
|
reverse: None,
|
||||||
batch_uids: self.batch_uids.merge_star_and_none(),
|
batch_uids: self.batch_uids.merge_star_and_none(),
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ async fn import_dump_v1_movie_with_settings() {
|
|||||||
"sortableAttributes": [
|
"sortableAttributes": [
|
||||||
"genres"
|
"genres"
|
||||||
],
|
],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
@@ -412,7 +411,6 @@ async fn import_dump_v1_rubygems_with_settings() {
|
|||||||
"sortableAttributes": [
|
"sortableAttributes": [
|
||||||
"version"
|
"version"
|
||||||
],
|
],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
@@ -742,7 +740,6 @@ async fn import_dump_v2_movie_with_settings() {
|
|||||||
"genres"
|
"genres"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"words",
|
"words",
|
||||||
"typo",
|
"typo",
|
||||||
@@ -914,7 +911,6 @@ async fn import_dump_v2_rubygems_with_settings() {
|
|||||||
"version"
|
"version"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
@@ -1244,7 +1240,6 @@ async fn import_dump_v3_movie_with_settings() {
|
|||||||
"genres"
|
"genres"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"words",
|
"words",
|
||||||
"typo",
|
"typo",
|
||||||
@@ -1416,7 +1411,6 @@ async fn import_dump_v3_rubygems_with_settings() {
|
|||||||
"version"
|
"version"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
@@ -1746,7 +1740,6 @@ async fn import_dump_v4_movie_with_settings() {
|
|||||||
"genres"
|
"genres"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"words",
|
"words",
|
||||||
"typo",
|
"typo",
|
||||||
@@ -1918,7 +1911,6 @@ async fn import_dump_v4_rubygems_with_settings() {
|
|||||||
"version"
|
"version"
|
||||||
],
|
],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
@@ -2198,8 +2190,7 @@ async fn import_dump_v6_containing_experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ async fn experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@@ -46,8 +45,7 @@ async fn experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@@ -65,8 +63,7 @@ async fn experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@@ -85,8 +82,7 @@ async fn experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@@ -105,8 +101,7 @@ async fn experimental_features() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
@@ -132,8 +127,7 @@ async fn experimental_feature_metrics() {
|
|||||||
"compositeEmbedders": false,
|
"compositeEmbedders": false,
|
||||||
"chatCompletions": false,
|
"chatCompletions": false,
|
||||||
"multimodal": false,
|
"multimodal": false,
|
||||||
"vectorStoreSetting": false,
|
"vectorStoreSetting": false
|
||||||
"foreignKeys": false
|
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@@ -180,7 +174,7 @@ async fn errors() {
|
|||||||
meili_snap::snapshot!(code, @"400 Bad Request");
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
||||||
meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
|
meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
|
||||||
{
|
{
|
||||||
"message": "Unknown field `NotAFeature`: expected one of `metrics`, `logsRoute`, `editDocumentsByFunction`, `containsFilter`, `network`, `getTaskDocumentsRoute`, `compositeEmbedders`, `chatCompletions`, `multimodal`, `vectorStoreSetting`, `foreignKeys`",
|
"message": "Unknown field `NotAFeature`: expected one of `metrics`, `logsRoute`, `editDocumentsByFunction`, `containsFilter`, `network`, `getTaskDocumentsRoute`, `compositeEmbedders`, `chatCompletions`, `multimodal`, `vectorStoreSetting`",
|
||||||
"code": "bad_request",
|
"code": "bad_request",
|
||||||
"type": "invalid_request",
|
"type": "invalid_request",
|
||||||
"link": "https://docs.meilisearch.com/errors#bad_request"
|
"link": "https://docs.meilisearch.com/errors#bad_request"
|
||||||
|
|||||||
@@ -318,7 +318,6 @@ async fn secrets_are_hidden_in_settings() {
|
|||||||
],
|
],
|
||||||
"filterableAttributes": [],
|
"filterableAttributes": [],
|
||||||
"sortableAttributes": [],
|
"sortableAttributes": [],
|
||||||
"foreignKeys": [],
|
|
||||||
"rankingRules": [
|
"rankingRules": [
|
||||||
"words",
|
"words",
|
||||||
"typo",
|
"typo",
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ pub mod main_key {
|
|||||||
pub const HIDDEN_FACETED_FIELDS_KEY: &str = "hidden-faceted-fields";
|
pub const HIDDEN_FACETED_FIELDS_KEY: &str = "hidden-faceted-fields";
|
||||||
pub const FILTERABLE_FIELDS_KEY: &str = "filterable-fields";
|
pub const FILTERABLE_FIELDS_KEY: &str = "filterable-fields";
|
||||||
pub const SORTABLE_FIELDS_KEY: &str = "sortable-fields";
|
pub const SORTABLE_FIELDS_KEY: &str = "sortable-fields";
|
||||||
pub const FOREIGN_KEYS_KEY: &str = "foreign-keys";
|
|
||||||
pub const FIELD_DISTRIBUTION_KEY: &str = "fields-distribution";
|
pub const FIELD_DISTRIBUTION_KEY: &str = "fields-distribution";
|
||||||
pub const FIELDS_IDS_MAP_KEY: &str = "fields-ids-map";
|
pub const FIELDS_IDS_MAP_KEY: &str = "fields-ids-map";
|
||||||
pub const FIELDIDS_WEIGHTS_MAP_KEY: &str = "fieldids-weights-map";
|
pub const FIELDIDS_WEIGHTS_MAP_KEY: &str = "fieldids-weights-map";
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ mod external_documents_ids;
|
|||||||
pub mod facet;
|
pub mod facet;
|
||||||
mod fields_ids_map;
|
mod fields_ids_map;
|
||||||
mod filterable_attributes_rules;
|
mod filterable_attributes_rules;
|
||||||
mod foreign_key;
|
|
||||||
pub mod heed_codec;
|
pub mod heed_codec;
|
||||||
pub mod index;
|
pub mod index;
|
||||||
mod localized_attributes_rules;
|
mod localized_attributes_rules;
|
||||||
@@ -72,7 +71,6 @@ pub use self::filterable_attributes_rules::{
|
|||||||
FilterFeatures, FilterableAttributesFeatures, FilterableAttributesPatterns,
|
FilterFeatures, FilterableAttributesFeatures, FilterableAttributesPatterns,
|
||||||
FilterableAttributesRule,
|
FilterableAttributesRule,
|
||||||
};
|
};
|
||||||
pub use self::foreign_key::ForeignKey;
|
|
||||||
pub use self::heed_codec::{
|
pub use self::heed_codec::{
|
||||||
BEU16StrCodec, BEU32StrCodec, BoRoaringBitmapCodec, BoRoaringBitmapLenCodec,
|
BEU16StrCodec, BEU32StrCodec, BoRoaringBitmapCodec, BoRoaringBitmapLenCodec,
|
||||||
CboRoaringBitmapCodec, CboRoaringBitmapLenCodec, FieldIdWordCountCodec, ObkvCodec,
|
CboRoaringBitmapCodec, CboRoaringBitmapLenCodec, FieldIdWordCountCodec, ObkvCodec,
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ use crate::vector::{
|
|||||||
VectorStoreBackend,
|
VectorStoreBackend,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
ChannelCongestion, FieldId, FilterableAttributesRule, ForeignKey, Index,
|
ChannelCongestion, FieldId, FilterableAttributesRule, Index, LocalizedAttributesRule, Result,
|
||||||
LocalizedAttributesRule, Result,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Eq, Copy)]
|
#[derive(Default, Debug, Clone, PartialEq, Eq, Copy)]
|
||||||
@@ -172,7 +171,6 @@ pub struct Settings<'a, 't, 'i> {
|
|||||||
displayed_fields: Setting<Vec<String>>,
|
displayed_fields: Setting<Vec<String>>,
|
||||||
filterable_fields: Setting<Vec<FilterableAttributesRule>>,
|
filterable_fields: Setting<Vec<FilterableAttributesRule>>,
|
||||||
sortable_fields: Setting<HashSet<String>>,
|
sortable_fields: Setting<HashSet<String>>,
|
||||||
foreign_keys: Setting<Vec<ForeignKey>>,
|
|
||||||
criteria: Setting<Vec<Criterion>>,
|
criteria: Setting<Vec<Criterion>>,
|
||||||
stop_words: Setting<BTreeSet<String>>,
|
stop_words: Setting<BTreeSet<String>>,
|
||||||
non_separator_tokens: Setting<BTreeSet<String>>,
|
non_separator_tokens: Setting<BTreeSet<String>>,
|
||||||
@@ -214,7 +212,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
displayed_fields: Setting::NotSet,
|
displayed_fields: Setting::NotSet,
|
||||||
filterable_fields: Setting::NotSet,
|
filterable_fields: Setting::NotSet,
|
||||||
sortable_fields: Setting::NotSet,
|
sortable_fields: Setting::NotSet,
|
||||||
foreign_keys: Setting::NotSet,
|
|
||||||
criteria: Setting::NotSet,
|
criteria: Setting::NotSet,
|
||||||
stop_words: Setting::NotSet,
|
stop_words: Setting::NotSet,
|
||||||
non_separator_tokens: Setting::NotSet,
|
non_separator_tokens: Setting::NotSet,
|
||||||
@@ -276,14 +273,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
self.sortable_fields = Setting::Reset;
|
self.sortable_fields = Setting::Reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_foreign_keys(&mut self, keys: Vec<ForeignKey>) {
|
|
||||||
self.foreign_keys = Setting::Set(keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset_foreign_keys(&mut self) {
|
|
||||||
self.foreign_keys = Setting::Reset;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset_criteria(&mut self) {
|
pub fn reset_criteria(&mut self) {
|
||||||
self.criteria = Setting::Reset;
|
self.criteria = Setting::Reset;
|
||||||
}
|
}
|
||||||
@@ -828,19 +817,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_foreign_keys(&mut self) -> Result<()> {
|
|
||||||
match self.foreign_keys {
|
|
||||||
Setting::Set(ref keys) => {
|
|
||||||
self.index.put_foreign_keys(self.wtxn, keys)?;
|
|
||||||
}
|
|
||||||
Setting::Reset => {
|
|
||||||
self.index.delete_foreign_keys(self.wtxn)?;
|
|
||||||
}
|
|
||||||
Setting::NotSet => (),
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_criteria(&mut self) -> Result<()> {
|
fn update_criteria(&mut self) -> Result<()> {
|
||||||
match &self.criteria {
|
match &self.criteria {
|
||||||
Setting::Set(criteria) => {
|
Setting::Set(criteria) => {
|
||||||
@@ -1474,7 +1450,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
self.update_sort_facet_values_by()?;
|
self.update_sort_facet_values_by()?;
|
||||||
self.update_pagination_max_total_hits()?;
|
self.update_pagination_max_total_hits()?;
|
||||||
self.update_search_cutoff()?;
|
self.update_search_cutoff()?;
|
||||||
self.update_foreign_keys()?;
|
|
||||||
|
|
||||||
// could trigger re-indexing
|
// could trigger re-indexing
|
||||||
self.update_filterable()?;
|
self.update_filterable()?;
|
||||||
@@ -1613,7 +1588,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
displayed_fields: Setting::NotSet,
|
displayed_fields: Setting::NotSet,
|
||||||
filterable_fields: Setting::NotSet,
|
filterable_fields: Setting::NotSet,
|
||||||
sortable_fields: Setting::NotSet,
|
sortable_fields: Setting::NotSet,
|
||||||
foreign_keys: Setting::NotSet,
|
|
||||||
criteria: Setting::NotSet,
|
criteria: Setting::NotSet,
|
||||||
stop_words: Setting::NotSet, // TODO (require force reindexing of searchables)
|
stop_words: Setting::NotSet, // TODO (require force reindexing of searchables)
|
||||||
non_separator_tokens: Setting::NotSet, // TODO (require force reindexing of searchables)
|
non_separator_tokens: Setting::NotSet, // TODO (require force reindexing of searchables)
|
||||||
|
|||||||
@@ -867,7 +867,6 @@ fn test_correct_settings_init() {
|
|||||||
displayed_fields,
|
displayed_fields,
|
||||||
filterable_fields,
|
filterable_fields,
|
||||||
sortable_fields,
|
sortable_fields,
|
||||||
foreign_keys,
|
|
||||||
criteria,
|
criteria,
|
||||||
stop_words,
|
stop_words,
|
||||||
non_separator_tokens,
|
non_separator_tokens,
|
||||||
@@ -898,7 +897,6 @@ fn test_correct_settings_init() {
|
|||||||
assert!(matches!(displayed_fields, Setting::NotSet));
|
assert!(matches!(displayed_fields, Setting::NotSet));
|
||||||
assert!(matches!(filterable_fields, Setting::NotSet));
|
assert!(matches!(filterable_fields, Setting::NotSet));
|
||||||
assert!(matches!(sortable_fields, Setting::NotSet));
|
assert!(matches!(sortable_fields, Setting::NotSet));
|
||||||
assert!(matches!(foreign_keys, Setting::NotSet));
|
|
||||||
assert!(matches!(criteria, Setting::NotSet));
|
assert!(matches!(criteria, Setting::NotSet));
|
||||||
assert!(matches!(stop_words, Setting::NotSet));
|
assert!(matches!(stop_words, Setting::NotSet));
|
||||||
assert!(matches!(non_separator_tokens, Setting::NotSet));
|
assert!(matches!(non_separator_tokens, Setting::NotSet));
|
||||||
|
|||||||
Reference in New Issue
Block a user