mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +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>");
|
||||
|
||||
while let Some((key, values, state)) = stream.next() {
|
||||
let values = &values[..values.len().min(10)];
|
||||
let distance = lev.distance(state);
|
||||
body.push_str(&format!("<p>{:?} (dist: {:?}) {:?}</p>", key, distance, values));
|
||||
match std::str::from_utf8(key) {
|
||||
Ok(key) => {
|
||||
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>");
|
||||
|
@ -9,7 +9,6 @@ use std::ops::Range;
|
||||
use std::io::{Write, BufReader};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::str::from_utf8_unchecked;
|
||||
use fst::Automaton;
|
||||
|
||||
pub use self::fst_map::{FstMap, FstMapBuilder};
|
||||
|
Loading…
Reference in New Issue
Block a user