fix all the tests

This commit is contained in:
Tamo 2021-09-01 17:43:18 +02:00
parent b1bf7d4f40
commit f0b74637dc
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
3 changed files with 8 additions and 8 deletions

View File

@ -21,7 +21,7 @@ use fxhash::{FxHasher32, FxHasher64};
pub use grenad::CompressionType; pub use grenad::CompressionType;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
pub use self::criterion::{default_criteria, AscDesc, Criterion}; pub use self::criterion::{default_criteria, AscDesc, Criterion, Member};
pub use self::error::{ pub use self::error::{
Error, FieldIdMapMissingEntry, InternalError, SerializationError, UserError, Error, FieldIdMapMissingEntry, InternalError, SerializationError, UserError,
}; };

View File

@ -6,7 +6,7 @@ use either::{Either, Left, Right};
use heed::EnvOpenOptions; use heed::EnvOpenOptions;
use maplit::{hashmap, hashset}; use maplit::{hashmap, hashset};
use milli::update::{Settings, UpdateBuilder, UpdateFormat}; use milli::update::{Settings, UpdateBuilder, UpdateFormat};
use milli::{AscDesc, Criterion, DocumentId, Index}; use milli::{AscDesc, Criterion, DocumentId, Index, Member};
use serde::Deserialize; use serde::Deserialize;
use slice_group_by::GroupBy; use slice_group_by::GroupBy;
@ -99,11 +99,11 @@ pub fn expected_order(
new_groups new_groups
.extend(group.linear_group_by_key(|d| d.proximity_rank).map(Vec::from)); .extend(group.linear_group_by_key(|d| d.proximity_rank).map(Vec::from));
} }
Criterion::Sort if sort_by == [AscDesc::Asc(S("tag"))] => { Criterion::Sort if sort_by == [AscDesc::Asc(Member::Field(S("tag")))] => {
group.sort_by_key(|d| d.sort_by_rank); group.sort_by_key(|d| d.sort_by_rank);
new_groups.extend(group.linear_group_by_key(|d| d.sort_by_rank).map(Vec::from)); new_groups.extend(group.linear_group_by_key(|d| d.sort_by_rank).map(Vec::from));
} }
Criterion::Sort if sort_by == [AscDesc::Desc(S("tag"))] => { Criterion::Sort if sort_by == [AscDesc::Desc(Member::Field(S("tag")))] => {
group.sort_by_key(|d| Reverse(d.sort_by_rank)); group.sort_by_key(|d| Reverse(d.sort_by_rank));
new_groups.extend(group.linear_group_by_key(|d| d.sort_by_rank).map(Vec::from)); new_groups.extend(group.linear_group_by_key(|d| d.sort_by_rank).map(Vec::from));
} }

View File

@ -163,28 +163,28 @@ test_criterion!(
DISALLOW_OPTIONAL_WORDS, DISALLOW_OPTIONAL_WORDS,
ALLOW_TYPOS, ALLOW_TYPOS,
vec![Sort], vec![Sort],
vec![AscDesc::Asc(S("tag"))] vec![AscDesc::Asc(Member::Field(S("tag")))]
); );
test_criterion!( test_criterion!(
sort_by_asc_disallow_typo, sort_by_asc_disallow_typo,
DISALLOW_OPTIONAL_WORDS, DISALLOW_OPTIONAL_WORDS,
DISALLOW_TYPOS, DISALLOW_TYPOS,
vec![Sort], vec![Sort],
vec![AscDesc::Asc(S("tag"))] vec![AscDesc::Asc(Member::Field(S("tag")))]
); );
test_criterion!( test_criterion!(
sort_by_desc_allow_typo, sort_by_desc_allow_typo,
DISALLOW_OPTIONAL_WORDS, DISALLOW_OPTIONAL_WORDS,
ALLOW_TYPOS, ALLOW_TYPOS,
vec![Sort], vec![Sort],
vec![AscDesc::Desc(S("tag"))] vec![AscDesc::Desc(Member::Field(S("tag")))]
); );
test_criterion!( test_criterion!(
sort_by_desc_disallow_typo, sort_by_desc_disallow_typo,
DISALLOW_OPTIONAL_WORDS, DISALLOW_OPTIONAL_WORDS,
DISALLOW_TYPOS, DISALLOW_TYPOS,
vec![Sort], vec![Sort],
vec![AscDesc::Desc(S("tag"))] vec![AscDesc::Desc(Member::Field(S("tag")))]
); );
test_criterion!( test_criterion!(
default_criteria_order, default_criteria_order,