summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorKeuin <[email protected]>2024-02-24 03:27:28 +0800
committerKeuin <[email protected]>2024-02-24 03:27:28 +0800
commitb48e221936a688bd1a1a5b1e3f2f08e43d0fe65a (patch)
treee895b83c10f9f9c8fb01559a3527193f5646ed13 /src/main.rs
parente670f5389171a7a124d990fe2093e1f9290eccfc (diff)
bugfix: non-distinct fields are ignored in result
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 3cb93db..220c69e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -245,10 +245,17 @@ async fn query(
}
};
for (field, value) in result {
+ if let Some(set) = all_result.get_mut(&field) {
+ set.insert(value.clone());
+ } else {
+ let mut s = HashSet::new();
+ s.insert(value.clone());
+ all_result.insert(field.clone(), s);
+ }
let v = RelationFieldValue {
relation: rel.cfg.name.clone(),
field: field.clone(),
- value: value.clone(),
+ value,
};
// skip non-distinct fields to prevent generating irrelevant results
if !state.fields.get(&field).expect("missing field info").distinct {
@@ -259,13 +266,6 @@ async fn query(
continue;
}
unvisited.insert(v);
- if let Some(set) = all_result.get_mut(&field) {
- set.insert(value);
- } else {
- let mut s = HashSet::new();
- s.insert(value);
- all_result.insert(field, s);
- }
}
unvisited.remove(&RelationFieldValue {
relation: rel.cfg.name.clone(),