From bbb6728d2f017f2a6eea34c15fd6a7c8155d77c1 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Fri, 8 Apr 2022 17:32:22 +0200 Subject: [PATCH] add distinct attributes to cli --- cli/src/main.rs | 10 ++++++++++ milli/src/search/mod.rs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/cli/src/main.rs b/cli/src/main.rs index 3e9e8c75f..97580142b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -469,6 +469,8 @@ struct SettingsUpdate { criteria: Option>, #[structopt(long)] exact_attributes: Option>, + #[structopt(long)] + distinct_attribute: Option, } impl Performer for SettingsUpdate { @@ -503,6 +505,14 @@ impl Performer for SettingsUpdate { } } + if let Some(distinct_attr) = self.distinct_attribute { + if !distinct_attr.is_empty() { + update.set_distinct_field(distinct_attr); + } else { + update.reset_distinct_field(); + } + } + let mut bars = Vec::new(); let progesses = MultiProgress::new(); for _ in 0..4 { diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index b01bae817..d53bcafb7 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -243,6 +243,8 @@ impl<'a> Search<'a> { excluded_candidates = candidates.into_excluded(); } + dbg!(excluded_candidates.len()); + Ok(SearchResult { matching_words, candidates: initial_candidates, documents_ids }) } }