Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 931169e

Browse files
authored
tripadvisor2mimir: add common values to properties (#76)
This will help Idunn which reads most of the data from the properties instead of reading other fields, which were usually specific to openmaptiles.
1 parent 982b9e6 commit 931169e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/bin/tripadvisor2mimir.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use tokio::fs::File;
1717
use tokio::io::{AsyncBufRead, BufReader};
1818
use tracing::info;
1919

20-
use fafnir::settings::FafnirSettings;
2120
use fafnir::sources::tripadvisor::{read_photos, read_pois};
2221

2322
/// Buffer size use for IO over XML files
@@ -33,7 +32,6 @@ struct TripAdvisorSettings {
3332
#[serde(rename_all = "kebab-case")]
3433
struct Settings {
3534
tripadvisor: TripAdvisorSettings,
36-
fafnir: FafnirSettings,
3735
elasticsearch: ElasticsearchStorageConfig,
3836
container_tripadvisor: ContainerConfig,
3937
}

src/sources/tripadvisor/pois/convert.rs

+8
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ pub fn build_poi(property: Property, geofinder: &AdminGeoFinder) -> Result<(u32,
146146
};
147147

148148
let properties = [
149+
("name", Some(name.clone())),
149150
("website", property.url),
151+
("poi_class", Some(category)),
152+
("poi_subclass", Some(sub_category)),
150153
("ta:url", property.ta_url),
151154
("ta:photos_url", property.ta_photos_url),
152155
("ta:review_count", Some(property.review_count.to_string())),
@@ -157,6 +160,11 @@ pub fn build_poi(property: Property, geofinder: &AdminGeoFinder) -> Result<(u32,
157160
]
158161
.into_iter()
159162
.filter_map(|(key, val)| Some((key.to_string(), val?)))
163+
.chain(
164+
(names.0)
165+
.iter()
166+
.map(|prop| (format!("name:{}", prop.key), prop.value.clone())),
167+
)
160168
.collect();
161169

162170
Ok((

0 commit comments

Comments
 (0)