neon_arch commited on
Commit
28fee6b
1 Parent(s): fa1ea8d

Adding minor change and implementing Cloning ability.

Browse files
src/search_results_handler/aggregation_models.rs CHANGED
@@ -28,6 +28,7 @@ impl SearchResult {
28
  }
29
  }
30
 
 
31
  pub struct RawSearchResult {
32
  pub title: String,
33
  pub visiting_url: String,
@@ -52,6 +53,10 @@ impl RawSearchResult {
52
  pub fn add_engines(&mut self, engine: String) {
53
  self.engine.push(engine)
54
  }
 
 
 
 
55
  }
56
 
57
  #[derive(Debug, Serialize)]
 
28
  }
29
  }
30
 
31
+ #[derive(Clone)]
32
  pub struct RawSearchResult {
33
  pub title: String,
34
  pub visiting_url: String,
 
53
  pub fn add_engines(&mut self, engine: String) {
54
  self.engine.push(engine)
55
  }
56
+
57
+ pub fn engine(self) -> String {
58
+ self.engine.get(0).unwrap().to_string()
59
+ }
60
  }
61
 
62
  #[derive(Debug, Serialize)]
src/search_results_handler/aggregator.rs CHANGED
@@ -36,7 +36,7 @@ pub async fn aggregate(
36
  result_map
37
  .entry(key)
38
  .and_modify(|result| {
39
- result.add_engines(value.engine[0].clone());
40
  })
41
  .or_insert_with(|| -> RawSearchResult {
42
  RawSearchResult::new(
 
36
  result_map
37
  .entry(key)
38
  .and_modify(|result| {
39
+ result.add_engines(value.clone().engine());
40
  })
41
  .or_insert_with(|| -> RawSearchResult {
42
  RawSearchResult::new(