mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 01:46:28 +00:00 
			
		
		
		
	Fix PR comments
This commit is contained in:
		@@ -16,9 +16,9 @@ macro_rules! test_criterion {
 | 
			
		||||
        fn $func() {
 | 
			
		||||
            let criteria = $criteria;
 | 
			
		||||
            let index = search::setup_search_index_with_criteria(&criteria);
 | 
			
		||||
            let mut rtxn = index.read_txn().unwrap();
 | 
			
		||||
            let rtxn = index.read_txn().unwrap();
 | 
			
		||||
 | 
			
		||||
            let mut search = Search::new(&mut rtxn, &index);
 | 
			
		||||
            let mut search = Search::new(&rtxn, &index);
 | 
			
		||||
            search.query(search::TEST_QUERY);
 | 
			
		||||
            search.limit(EXTERNAL_DOCUMENTS_IDS.len());
 | 
			
		||||
            search.authorize_typos($authorize_typos);
 | 
			
		||||
@@ -37,42 +37,69 @@ macro_rules! test_criterion {
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(none_allow_typo,                     ALLOW_OPTIONAL_WORDS,      ALLOW_TYPOS,    vec![]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(none_disallow_typo,                  DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(words_allow_typo,                    ALLOW_OPTIONAL_WORDS,      ALLOW_TYPOS,    vec![Words]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(attribute_allow_typo,                DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Attribute]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(attribute_disallow_typo,             DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Attribute]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(exactness_allow_typo,                DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Exactness]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(exactness_disallow_typo,             DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Exactness]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(proximity_allow_typo,                DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Proximity]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(proximity_disallow_typo,             DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Proximity]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(asc_allow_typo,                      DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Asc(S("asc_desc_rank"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(asc_disallow_typo,                   DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Asc(S("asc_desc_rank"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(desc_allow_typo,                     DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Desc(S("asc_desc_rank"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(desc_disallow_typo,                  DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Desc(S("asc_desc_rank"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(asc_unexisting_field_allow_typo,     DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Asc(S("unexisting_field"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(asc_unexisting_field_disallow_typo,  DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Asc(S("unexisting_field"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(desc_unexisting_field_allow_typo,    DISALLOW_OPTIONAL_WORDS,   ALLOW_TYPOS,    vec![Desc(S("unexisting_field"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(desc_unexisting_field_disallow_typo, DISALLOW_OPTIONAL_WORDS,   DISALLOW_TYPOS, vec![Desc(S("unexisting_field"))]);
 | 
			
		||||
#[rustfmt::skip]
 | 
			
		||||
test_criterion!(default_criteria_order,              ALLOW_OPTIONAL_WORDS,      ALLOW_TYPOS,    vec![Words, Typo, Proximity, Attribute, Exactness]);
 | 
			
		||||
test_criterion!(none_allow_typo, ALLOW_OPTIONAL_WORDS, ALLOW_TYPOS, vec![]);
 | 
			
		||||
test_criterion!(none_disallow_typo, DISALLOW_OPTIONAL_WORDS, DISALLOW_TYPOS, vec![]);
 | 
			
		||||
test_criterion!(words_allow_typo, ALLOW_OPTIONAL_WORDS, ALLOW_TYPOS, vec![Words]);
 | 
			
		||||
test_criterion!(attribute_allow_typo, DISALLOW_OPTIONAL_WORDS, ALLOW_TYPOS, vec![Attribute]);
 | 
			
		||||
test_criterion!(attribute_disallow_typo, DISALLOW_OPTIONAL_WORDS, DISALLOW_TYPOS, vec![Attribute]);
 | 
			
		||||
test_criterion!(exactness_allow_typo, DISALLOW_OPTIONAL_WORDS, ALLOW_TYPOS, vec![Exactness]);
 | 
			
		||||
test_criterion!(exactness_disallow_typo, DISALLOW_OPTIONAL_WORDS, DISALLOW_TYPOS, vec![Exactness]);
 | 
			
		||||
test_criterion!(proximity_allow_typo, DISALLOW_OPTIONAL_WORDS, ALLOW_TYPOS, vec![Proximity]);
 | 
			
		||||
test_criterion!(proximity_disallow_typo, DISALLOW_OPTIONAL_WORDS, DISALLOW_TYPOS, vec![Proximity]);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    asc_allow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    ALLOW_TYPOS,
 | 
			
		||||
    vec![Asc(S("asc_desc_rank"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    asc_disallow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    DISALLOW_TYPOS,
 | 
			
		||||
    vec![Asc(S("asc_desc_rank"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    desc_allow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    ALLOW_TYPOS,
 | 
			
		||||
    vec![Desc(S("asc_desc_rank"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    desc_disallow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    DISALLOW_TYPOS,
 | 
			
		||||
    vec![Desc(S("asc_desc_rank"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    asc_unexisting_field_allow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    ALLOW_TYPOS,
 | 
			
		||||
    vec![Asc(S("unexisting_field"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    asc_unexisting_field_disallow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    DISALLOW_TYPOS,
 | 
			
		||||
    vec![Asc(S("unexisting_field"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    desc_unexisting_field_allow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    ALLOW_TYPOS,
 | 
			
		||||
    vec![Desc(S("unexisting_field"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    desc_unexisting_field_disallow_typo,
 | 
			
		||||
    DISALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    DISALLOW_TYPOS,
 | 
			
		||||
    vec![Desc(S("unexisting_field"))]
 | 
			
		||||
);
 | 
			
		||||
test_criterion!(
 | 
			
		||||
    default_criteria_order,
 | 
			
		||||
    ALLOW_OPTIONAL_WORDS,
 | 
			
		||||
    ALLOW_TYPOS,
 | 
			
		||||
    vec![Words, Typo, Proximity, Attribute, Exactness]
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn criteria_mixup() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user