mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
feat: Display not utf-8 error results
This commit is contained in:
parent
0f9ada1c4e
commit
758baeb8e1
@ -66,9 +66,14 @@ impl<'a> Service for MainService<'a> {
|
|||||||
body.push_str("<html><body>");
|
body.push_str("<html><body>");
|
||||||
|
|
||||||
while let Some((key, values, state)) = stream.next() {
|
while let Some((key, values, state)) = stream.next() {
|
||||||
let values = &values[..values.len().min(10)];
|
match std::str::from_utf8(key) {
|
||||||
let distance = lev.distance(state);
|
Ok(key) => {
|
||||||
body.push_str(&format!("<p>{:?} (dist: {:?}) {:?}</p>", key, distance, values));
|
let values = &values[..values.len().min(10)];
|
||||||
|
let distance = lev.distance(state);
|
||||||
|
body.push_str(&format!("<p>{:?} (dist: {:?}) {:?}</p>", key, distance, values));
|
||||||
|
},
|
||||||
|
Err(e) => eprintln!("{:?}", e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body.push_str("</body></html>");
|
body.push_str("</body></html>");
|
||||||
|
@ -9,7 +9,6 @@ use std::ops::Range;
|
|||||||
use std::io::{Write, BufReader};
|
use std::io::{Write, BufReader};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::str::from_utf8_unchecked;
|
|
||||||
use fst::Automaton;
|
use fst::Automaton;
|
||||||
|
|
||||||
pub use self::fst_map::{FstMap, FstMapBuilder};
|
pub use self::fst_map::{FstMap, FstMapBuilder};
|
||||||
|
Loading…
Reference in New Issue
Block a user