mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Merge #946
946: Sort displayedAttributes field r=MarinPostma a=gorogoroumaru Fix #943 displayedAttributes use the HashSet struct which is an unsorted structure, so I changed the implementation from HashSet into BTreeSet. Co-authored-by: gorogoroumaru <zokutyou2@gmail.com>
This commit is contained in:
commit
f359b64d59
8 changed files with 96 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use actix_web::{delete, get, post};
|
||||
use actix_web::{web, HttpResponse};
|
||||
|
@ -405,7 +405,7 @@ async fn get_displayed(
|
|||
async fn update_displayed(
|
||||
data: web::Data<Data>,
|
||||
path: web::Path<IndexParam>,
|
||||
body: web::Json<Option<HashSet<String>>>,
|
||||
body: web::Json<Option<BTreeSet<String>>>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let index = data
|
||||
.db
|
||||
|
@ -539,7 +539,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() {
|
||||
["*"].iter().map(|s| s.to_string()).collect()
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
|
||||
use actix_web::web;
|
||||
use actix_web::HttpResponse;
|
||||
|
@ -24,7 +24,7 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||
struct IndexStatsResponse {
|
||||
number_of_documents: u64,
|
||||
is_indexing: bool,
|
||||
fields_distribution: HashMap<String, usize>,
|
||||
fields_distribution: BTreeMap<String, usize>,
|
||||
}
|
||||
|
||||
#[get("/indexes/{index_uid}/stats", wrap = "Authentication::Private")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue