mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
changed the implementation of displayedAttributes from HashSet into BtreeSet
This commit is contained in:
parent
c94daf8c3d
commit
e47b4acd08
@ -1,4 +1,4 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::iter::IntoIterator;
|
use std::iter::IntoIterator;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ pub struct Settings {
|
|||||||
#[serde(default, deserialize_with = "deserialize_some")]
|
#[serde(default, deserialize_with = "deserialize_some")]
|
||||||
pub searchable_attributes: Option<Option<Vec<String>>>,
|
pub searchable_attributes: Option<Option<Vec<String>>>,
|
||||||
#[serde(default, deserialize_with = "deserialize_some")]
|
#[serde(default, deserialize_with = "deserialize_some")]
|
||||||
pub displayed_attributes: Option<Option<HashSet<String>>>,
|
pub displayed_attributes: Option<Option<BTreeSet<String>>>,
|
||||||
#[serde(default, deserialize_with = "deserialize_some")]
|
#[serde(default, deserialize_with = "deserialize_some")]
|
||||||
pub stop_words: Option<Option<BTreeSet<String>>>,
|
pub stop_words: Option<Option<BTreeSet<String>>>,
|
||||||
#[serde(default, deserialize_with = "deserialize_some")]
|
#[serde(default, deserialize_with = "deserialize_some")]
|
||||||
@ -161,7 +161,7 @@ pub struct SettingsUpdate {
|
|||||||
pub distinct_attribute: UpdateState<String>,
|
pub distinct_attribute: UpdateState<String>,
|
||||||
pub primary_key: UpdateState<String>,
|
pub primary_key: UpdateState<String>,
|
||||||
pub searchable_attributes: UpdateState<Vec<String>>,
|
pub searchable_attributes: UpdateState<Vec<String>>,
|
||||||
pub displayed_attributes: UpdateState<HashSet<String>>,
|
pub displayed_attributes: UpdateState<BTreeSet<String>>,
|
||||||
pub stop_words: UpdateState<BTreeSet<String>>,
|
pub stop_words: UpdateState<BTreeSet<String>>,
|
||||||
pub synonyms: UpdateState<BTreeMap<String, Vec<String>>>,
|
pub synonyms: UpdateState<BTreeMap<String, Vec<String>>>,
|
||||||
pub attributes_for_faceting: UpdateState<Vec<String>>,
|
pub attributes_for_faceting: UpdateState<Vec<String>>,
|
||||||
|
@ -2,7 +2,7 @@ use actix_web::{web, HttpResponse};
|
|||||||
use actix_web_macros::{delete, get, post};
|
use actix_web_macros::{delete, get, post};
|
||||||
use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState, DEFAULT_RANKING_RULES};
|
use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState, DEFAULT_RANKING_RULES};
|
||||||
use meilisearch_schema::Schema;
|
use meilisearch_schema::Schema;
|
||||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
use crate::error::{Error, ResponseError};
|
use crate::error::{Error, ResponseError};
|
||||||
use crate::helpers::Authentication;
|
use crate::helpers::Authentication;
|
||||||
@ -390,7 +390,7 @@ async fn get_displayed(
|
|||||||
async fn update_displayed(
|
async fn update_displayed(
|
||||||
data: web::Data<Data>,
|
data: web::Data<Data>,
|
||||||
path: web::Path<IndexParam>,
|
path: web::Path<IndexParam>,
|
||||||
body: web::Json<Option<HashSet<String>>>,
|
body: web::Json<Option<BTreeSet<String>>>,
|
||||||
) -> Result<HttpResponse, ResponseError> {
|
) -> Result<HttpResponse, ResponseError> {
|
||||||
let index = data
|
let index = data
|
||||||
.db
|
.db
|
||||||
@ -524,7 +524,7 @@ fn get_indexed_attributes(schema: &Schema) -> Vec<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_displayed_attributes(schema: &Schema) -> HashSet<String> {
|
fn get_displayed_attributes(schema: &Schema) -> BTreeSet<String> {
|
||||||
if schema.is_displayed_all() {
|
if schema.is_displayed_all() {
|
||||||
["*"].iter().map(|s| s.to_string()).collect()
|
["*"].iter().map(|s| s.to_string()).collect()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user