Skip to content

Commit

Permalink
added substring search
Browse files Browse the repository at this point in the history
  • Loading branch information
marsupialtail committed Mar 26, 2024
1 parent d7c8070 commit 0d5a256
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lava/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use core::num;
use futures::{FutureExt, SinkExt};
use itertools::Itertools;
use ndarray::Array2;
use std::collections::BTreeSet;
use std::env;
use std::{
collections::{HashMap, HashSet},
Expand Down Expand Up @@ -188,7 +189,7 @@ async fn search_substring_async(
));
}

let mut result = vec![];
let mut result: BTreeSet<(u64, u64)> = BTreeSet::new();
while let Some(res) = join_set.join_next().await {
let res = res.unwrap().unwrap();
result.extend(res);
Expand All @@ -200,7 +201,7 @@ async fn search_substring_async(
join_set.shutdown().await;

// keep only k elements in the result

let mut result: Vec<(u64, u64)> = result.into_iter().collect_vec();
result.truncate(k);
Ok(result)
}
Expand Down

0 comments on commit 0d5a256

Please sign in to comment.