Search options are expected to be in an array now instead of top level
definitions when searching.
This commit is contained in:
parent
ac740c76b6
commit
d7c865663b
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ node_modules
|
||||
/target
|
||||
nzz/
|
||||
result
|
||||
.direnv/
|
||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -921,7 +921,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nzz-download"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nzz-download"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
license = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
|
@ -12,15 +12,17 @@ const SEARCH_URL: &str = "https://zeitungsarchiv.nzz.ch/solr-epaper-search/1.0/s
|
||||
const ISSUE_URL: &str = "https://zeitungsarchiv.nzz.ch/archive/1.0/getPages";
|
||||
const MAX_DOWNLOADS: usize = 4;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct SortOption {
|
||||
field: String,
|
||||
order: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct SearchData {
|
||||
query: String,
|
||||
offset: u32,
|
||||
#[serde(rename = "sortField")]
|
||||
sort_field: String,
|
||||
#[serde(rename = "sortOrder")]
|
||||
sort_order: String,
|
||||
#[serde(
|
||||
#[serde(
|
||||
rename = "startDate",
|
||||
serialize_with = "crate::date::serialize",
|
||||
deserialize_with = "crate::date::deserialize"
|
||||
@ -32,6 +34,8 @@ struct SearchData {
|
||||
deserialize_with = "crate::date::deserialize"
|
||||
)]
|
||||
end_date: Date,
|
||||
#[serde(rename = "sortOptions")]
|
||||
sort_options: Vec<SortOption>
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
@ -105,8 +109,7 @@ impl SearchData {
|
||||
Self {
|
||||
query: "".to_string(),
|
||||
offset,
|
||||
sort_field: "media_ts".to_string(),
|
||||
sort_order: "desc".to_string(),
|
||||
sort_options: vec![SortOption { field: "media_ts".to_string(), order: "desc".to_string() }],
|
||||
start_date,
|
||||
end_date,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user