mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
fix style
This commit is contained in:
parent
c290719984
commit
0731971300
@ -304,22 +304,22 @@ mod tests {
|
|||||||
use meilisearch_schema::Schema;
|
use meilisearch_schema::Schema;
|
||||||
|
|
||||||
fn is_cjk(c: char) -> bool {
|
fn is_cjk(c: char) -> bool {
|
||||||
(c >= '\u{1100}' && c <= '\u{11ff}') // Hangul Jamo
|
('\u{1100}'..'\u{11ff}').contains(&c) // Hangul Jamo
|
||||||
|| (c >= '\u{2e80}' && c <= '\u{2eff}') // CJK Radicals Supplement
|
|| ('\u{2e80}'..'\u{2eff}').contains(&c) // CJK Radicals Supplement
|
||||||
|| (c >= '\u{2f00}' && c <= '\u{2fdf}') // Kangxi radical
|
|| ('\u{2f00}'..'\u{2fdf}').contains(&c) // Kangxi radical
|
||||||
|| (c >= '\u{3000}' && c <= '\u{303f}') // Japanese-style punctuation
|
|| ('\u{3000}'..'\u{303f}').contains(&c) // Japanese-style punctuation
|
||||||
|| (c >= '\u{3040}' && c <= '\u{309f}') // Japanese Hiragana
|
|| ('\u{3040}'..'\u{309f}').contains(&c) // Japanese Hiragana
|
||||||
|| (c >= '\u{30a0}' && c <= '\u{30ff}') // Japanese Katakana
|
|| ('\u{30a0}'..'\u{30ff}').contains(&c) // Japanese Katakana
|
||||||
|| (c >= '\u{3100}' && c <= '\u{312f}')
|
|| ('\u{3100}'..'\u{312f}').contains(&c)
|
||||||
|| (c >= '\u{3130}' && c <= '\u{318F}') // Hangul Compatibility Jamo
|
|| ('\u{3130}'..'\u{318F}').contains(&c) // Hangul Compatibility Jamo
|
||||||
|| (c >= '\u{3200}' && c <= '\u{32ff}') // Enclosed CJK Letters and Months
|
|| ('\u{3200}'..'\u{32ff}').contains(&c) // Enclosed CJK Letters and Months
|
||||||
|| (c >= '\u{3400}' && c <= '\u{4dbf}') // CJK Unified Ideographs Extension A
|
|| ('\u{3400}'..'\u{4dbf}').contains(&c) // CJK Unified Ideographs Extension A
|
||||||
|| (c >= '\u{4e00}' && c <= '\u{9fff}') // CJK Unified Ideographs
|
|| ('\u{4e00}'..'\u{9fff}').contains(&c) // CJK Unified Ideographs
|
||||||
|| (c >= '\u{a960}' && c <= '\u{a97f}') // Hangul Jamo Extended-A
|
|| ('\u{a960}'..'\u{a97f}').contains(&c) // Hangul Jamo Extended-A
|
||||||
|| (c >= '\u{ac00}' && c <= '\u{d7a3}') // Hangul Syllables
|
|| ('\u{ac00}'..'\u{d7a3}').contains(&c) // Hangul Syllables
|
||||||
|| (c >= '\u{d7b0}' && c <= '\u{d7ff}') // Hangul Jamo Extended-B
|
|| ('\u{d7b0}'..'\u{d7ff}').contains(&c) // Hangul Jamo Extended-B
|
||||||
|| (c >= '\u{f900}' && c <= '\u{faff}') // CJK Compatibility Ideographs
|
|| ('\u{f900}'..'\u{faff}').contains(&c) // CJK Compatibility Ideographs
|
||||||
|| (c >= '\u{ff00}' && c <= '\u{ffef}') // Full-width roman characters and half-width katakana
|
|| ('\u{ff00}'..'\u{ffef}').contains(&c) // Full-width roman characters and half-width katakana
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalize_str(string: &str) -> String {
|
fn normalize_str(string: &str) -> String {
|
||||||
|
@ -479,7 +479,7 @@ fn calculate_highlights(
|
|||||||
for (attribute, matches) in matches.iter() {
|
for (attribute, matches) in matches.iter() {
|
||||||
if attributes_to_highlight.contains(attribute) {
|
if attributes_to_highlight.contains(attribute) {
|
||||||
if let Some(Value::String(value)) = document.get(attribute) {
|
if let Some(Value::String(value)) = document.get(attribute) {
|
||||||
let value = value.clone();
|
let value = value;
|
||||||
let mut highlighted_value = String::new();
|
let mut highlighted_value = String::new();
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
|
|
||||||
@ -613,7 +613,6 @@ mod tests {
|
|||||||
assert_eq!(result, result_expected);
|
assert_eq!(result, result_expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn highlight_longest_match() {
|
fn highlight_longest_match() {
|
||||||
let data = r#"{
|
let data = r#"{
|
||||||
|
@ -7,20 +7,20 @@ pub use authentication::Authentication;
|
|||||||
pub use normalize_path::NormalizePath;
|
pub use normalize_path::NormalizePath;
|
||||||
|
|
||||||
pub fn is_cjk(c: char) -> bool {
|
pub fn is_cjk(c: char) -> bool {
|
||||||
(c >= '\u{1100}' && c <= '\u{11ff}') // Hangul Jamo
|
('\u{1100}'..'\u{11ff}').contains(&c) // Hangul Jamo
|
||||||
|| (c >= '\u{2e80}' && c <= '\u{2eff}') // CJK Radicals Supplement
|
|| ('\u{2e80}'..'\u{2eff}').contains(&c) // CJK Radicals Supplement
|
||||||
|| (c >= '\u{2f00}' && c <= '\u{2fdf}') // Kangxi radical
|
|| ('\u{2f00}'..'\u{2fdf}').contains(&c) // Kangxi radical
|
||||||
|| (c >= '\u{3000}' && c <= '\u{303f}') // Japanese-style punctuation
|
|| ('\u{3000}'..'\u{303f}').contains(&c) // Japanese-style punctuation
|
||||||
|| (c >= '\u{3040}' && c <= '\u{309f}') // Japanese Hiragana
|
|| ('\u{3040}'..'\u{309f}').contains(&c) // Japanese Hiragana
|
||||||
|| (c >= '\u{30a0}' && c <= '\u{30ff}') // Japanese Katakana
|
|| ('\u{30a0}'..'\u{30ff}').contains(&c) // Japanese Katakana
|
||||||
|| (c >= '\u{3100}' && c <= '\u{312f}')
|
|| ('\u{3100}'..'\u{312f}').contains(&c)
|
||||||
|| (c >= '\u{3130}' && c <= '\u{318F}') // Hangul Compatibility Jamo
|
|| ('\u{3130}'..'\u{318F}').contains(&c) // Hangul Compatibility Jamo
|
||||||
|| (c >= '\u{3200}' && c <= '\u{32ff}') // Enclosed CJK Letters and Months
|
|| ('\u{3200}'..'\u{32ff}').contains(&c) // Enclosed CJK Letters and Months
|
||||||
|| (c >= '\u{3400}' && c <= '\u{4dbf}') // CJK Unified Ideographs Extension A
|
|| ('\u{3400}'..'\u{4dbf}').contains(&c) // CJK Unified Ideographs Extension A
|
||||||
|| (c >= '\u{4e00}' && c <= '\u{9fff}') // CJK Unified Ideographs
|
|| ('\u{4e00}'..'\u{9fff}').contains(&c) // CJK Unified Ideographs
|
||||||
|| (c >= '\u{a960}' && c <= '\u{a97f}') // Hangul Jamo Extended-A
|
|| ('\u{a960}'..'\u{a97f}').contains(&c) // Hangul Jamo Extended-A
|
||||||
|| (c >= '\u{ac00}' && c <= '\u{d7a3}') // Hangul Syllables
|
|| ('\u{ac00}'..'\u{d7a3}').contains(&c) // Hangul Syllables
|
||||||
|| (c >= '\u{d7b0}' && c <= '\u{d7ff}') // Hangul Jamo Extended-B
|
|| ('\u{d7b0}'..'\u{d7ff}').contains(&c) // Hangul Jamo Extended-B
|
||||||
|| (c >= '\u{f900}' && c <= '\u{faff}') // CJK Compatibility Ideographs
|
|| ('\u{f900}'..'\u{faff}').contains(&c) // CJK Compatibility Ideographs
|
||||||
|| (c >= '\u{ff00}' && c <= '\u{ffef}') // Full-width roman characters and half-width katakana
|
|| ('\u{ff00}'..'\u{ffef}').contains(&c) // Full-width roman characters and half-width katakana
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user