Skip to content

Commit 237b1eb

Browse files
committed
perf: skip segment leaf expansion in organizationsToMerge query
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 9215220 commit 237b1eb

5 files changed

Lines changed: 9 additions & 42 deletions

File tree

backend/src/database/repositories/organizationRepository.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,9 @@ class OrganizationRepository {
842842
const HIGH_CONFIDENCE_LOWER_BOUND = 0.9
843843
const MEDIUM_CONFIDENCE_LOWER_BOUND = 0.7
844844

845-
const currentSegments = SequelizeRepository.getSegmentIds(options)
846-
const segmentIds = (
847-
await new SegmentRepository(options).getSegmentSubprojects(currentSegments)
848-
).map((s) => s.id)
845+
// Organization segments are aggregated at each hierarchy level (group -> project -> subproject).
846+
// Match the selected segment ID(s) directly; do not expand to leaf subprojects.
847+
const segmentIds = SequelizeRepository.getSegmentIds(options)
849848

850849
let similarityFilter = ''
851850
const similarityConditions = []

frontend/src/modules/data-quality/components/member/data-quality-member-merge-suggestions.vue

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,8 @@ const detailsOffset = ref<number>(0);
8484
const { selectedProjectGroup } = storeToRefs(useLfSegmentsStore());
8585
8686
const segments = computed(() => (selectedProjectGroup.value?.id === props.projectGroup
87-
? [
88-
selectedProjectGroup.value?.id,
89-
...selectedProjectGroup.value.projects.map((p) => [
90-
...p.subprojects.map((sp) => sp.id),
91-
]).flat(),
92-
]
93-
: [
94-
props.projectGroup,
95-
...selectedProjectGroup.value.projects
96-
.filter((p) => p.id === props.projectGroup)
97-
.map((p) => [
98-
...p.subprojects.map((sp) => sp.id),
99-
]).flat(),
100-
]));
87+
? [selectedProjectGroup.value?.id]
88+
: [props.projectGroup]));
10189
10290
const loadMergeSuggestions = () => {
10391
loading.value = true;

frontend/src/modules/data-quality/components/organization/data-quality-organization-merge-suggestions.vue

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,8 @@ const detailsOffset = ref<number>(0);
7878
const { selectedProjectGroup } = storeToRefs(useLfSegmentsStore());
7979
8080
const segments = computed(() => (selectedProjectGroup.value?.id === props.projectGroup
81-
? [
82-
selectedProjectGroup.value?.id,
83-
...selectedProjectGroup.value.projects.map((p) => [
84-
...p.subprojects.map((sp) => sp.id),
85-
]).flat(),
86-
]
87-
: [
88-
props.projectGroup,
89-
...selectedProjectGroup.value.projects
90-
.filter((p) => p.id === props.projectGroup)
91-
.map((p) => [
92-
...p.subprojects.map((sp) => sp.id),
93-
]).flat(),
94-
]));
81+
? [selectedProjectGroup.value?.id]
82+
: [props.projectGroup]));
9583
9684
const loadMergeSuggestions = () => {
9785
loading.value = true;

frontend/src/modules/organization/organization-service.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import authAxios from '@/shared/axios/auth-axios';
22
import { AuthService } from '@/modules/auth/services/auth.service'; import { storeToRefs } from 'pinia';
33
import { useLfSegmentsStore } from '@/modules/lf/segments/store';
4-
import { getSegmentsFromProjectGroup } from '@/utils/segments';
54

65
const getSelectedProjectGroup = () => {
76
const lsSegmentsStore = useLfSegmentsStore();
@@ -216,10 +215,7 @@ export class OrganizationService {
216215
}
217216

218217
static async fetchMergeSuggestions(limit, offset, query) {
219-
const segments = [
220-
...getSegmentsFromProjectGroup(getSelectedProjectGroup()),
221-
getSelectedProjectGroup().id,
222-
];
218+
const segments = [getSelectedProjectGroup().id];
223219

224220
const data = {
225221
limit,

frontend/src/modules/organization/services/organization.api.service.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import authAxios from '@/shared/axios/auth-axios';
22
import { Organization } from '@/modules/organization/types/Organization';
3-
import { getSegmentsFromProjectGroup } from '@/utils/segments';
43
import { useLfSegmentsStore } from '@/modules/lf/segments/store';
54
import { storeToRefs } from 'pinia';
65

@@ -33,10 +32,7 @@ export class OrganizationApiService {
3332
const lsSegmentsStore = useLfSegmentsStore();
3433
const { selectedProjectGroup } = storeToRefs(lsSegmentsStore);
3534

36-
const segments = [
37-
...getSegmentsFromProjectGroup(selectedProjectGroup.value),
38-
selectedProjectGroup.value?.id,
39-
];
35+
const segments = [selectedProjectGroup.value?.id];
4036

4137
const data = {
4238
limit,

0 commit comments

Comments
 (0)