update codebase with shcema refactor

This commit is contained in:
mpostma
2020-12-15 12:04:51 +01:00
parent 54686b0505
commit 2904ca7f57
9 changed files with 27 additions and 28 deletions

View File

@ -1,4 +1,4 @@
use std::collections::{HashMap, HashSet};
use std::collections::{HashMap, HashSet, BTreeSet};
use actix_web::{get, post, web, HttpResponse};
use log::warn;
@ -120,8 +120,8 @@ impl SearchQuery {
search_builder.limit(limit);
}
let available_attributes = schema.displayed_name();
let mut restricted_attributes: HashSet<&str>;
let available_attributes = schema.displayed_names();
let mut restricted_attributes: BTreeSet<&str>;
match &self.attributes_to_retrieve {
Some(attributes_to_retrieve) => {
let attributes_to_retrieve: HashSet<&str> =
@ -129,7 +129,7 @@ impl SearchQuery {
if attributes_to_retrieve.contains("*") {
restricted_attributes = available_attributes.clone();
} else {
restricted_attributes = HashSet::new();
restricted_attributes = BTreeSet::new();
search_builder.attributes_to_retrieve(HashSet::new());
for attr in attributes_to_retrieve {
if available_attributes.contains(attr) {

View File

@ -523,11 +523,11 @@ async fn delete_attributes_for_faceting(
}
fn get_indexed_attributes(schema: &Schema) -> Vec<String> {
if schema.is_indexed_all() {
if schema.is_searchable_all() {
["*"].iter().map(|s| s.to_string()).collect()
} else {
schema
.indexed_name()
.searchable_names()
.iter()
.map(|s| s.to_string())
.collect()
@ -539,7 +539,7 @@ fn get_displayed_attributes(schema: &Schema) -> BTreeSet<String> {
["*"].iter().map(|s| s.to_string()).collect()
} else {
schema
.displayed_name()
.displayed_names()
.iter()
.map(|s| s.to_string())
.collect()