Fix: rename file_name to filename
This commit is contained in:
@@ -23,5 +23,11 @@ pub struct Source {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct File {
|
||||
pub file_name: String,
|
||||
pub filename: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simple() {
|
||||
let data = "{\"hits\":{\"hits\":[{\"_source\":{\"file\":{\"filename\":\"4girls.md\"}}},{\"_source\":{\"file\":{\"filename\":\"diversity.md\"}}},{\"_source\":{\"file\":{\"filename\":\"gametalks.md\"}}},{\"_source\":{\"file\":{\"filename\":\"wagtail.md\"}}},{\"_source\":{\"file\":{\"filename\":\"pythonineducation.md\"}}},{\"_source\":{\"file\":{\"filename\":\"hyper.md\"}}},{\"_source\":{\"file\":{\"filename\":\"fantasy.md\"}}}]}}";
|
||||
let _: ElasticResponse = serde_json::from_str(data).unwrap();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ fn query_elastic_search(query: String) -> Result<String, Box<dyn Error>> {
|
||||
|
||||
let res = query.send(options::elastic_search::URL.clone())?;
|
||||
|
||||
Ok(res.hits.hits[0].source.file.file_name.clone())
|
||||
Ok(res.hits.hits[0].source.file.filename.clone())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user