Skip to content

Commit de3f5e2

Browse files
committed
chore(): disable grouping by levenstein
1 parent 6947129 commit de3f5e2

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

workers/grouper/src/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default class GrouperWorker extends Worker {
109109
let existedEvent = await this.getEvent(task.projectId, uniqueEventHash);
110110

111111
/**
112-
* If we couldn't group by group hash (title), try grouping by Levenshtein distance or patterns
112+
* If we couldn't group by group hash (title), try grouping by patterns
113113
*/
114114
if (!existedEvent) {
115115
const similarEvent = await this.findSimilarEvent(task.projectId, task.payload);
@@ -287,35 +287,35 @@ export default class GrouperWorker extends Worker {
287287
* @param event - event to compare
288288
*/
289289
private async findSimilarEvent(projectId: string, event: EventData<EventAddons>): Promise<GroupedEventDBScheme | undefined> {
290-
const eventsCountToCompare = 60;
291-
const diffTreshold = 0.35;
290+
// const eventsCountToCompare = 60;
291+
// const diffTreshold = 0.35;
292292

293-
const lastUniqueEvents = await this.findLastEvents(projectId, eventsCountToCompare);
293+
// const lastUniqueEvents = await this.findLastEvents(projectId, eventsCountToCompare);
294294

295295
/**
296296
* Trim titles to reduce CPU usage for Levenshtein comparison
297297
*/
298-
const trimmedEventTitle = hasValue(event.title) ? rightTrim(event.title, MAX_CODE_LINE_LENGTH) : '';
298+
// const trimmedEventTitle = hasValue(event.title) ? rightTrim(event.title, MAX_CODE_LINE_LENGTH) : '';
299299

300300
/**
301301
* First try to find by Levenshtein distance
302302
*/
303-
const similarByLevenshtein = lastUniqueEvents.filter(prevEvent => {
304-
const trimmedPrevTitle = hasValue(prevEvent.payload.title) ? rightTrim(prevEvent.payload.title, MAX_CODE_LINE_LENGTH) : '';
303+
// const similarByLevenshtein = lastUniqueEvents.filter(prevEvent => {
304+
// const trimmedPrevTitle = hasValue(prevEvent.payload.title) ? rightTrim(prevEvent.payload.title, MAX_CODE_LINE_LENGTH) : '';
305305

306-
if (trimmedEventTitle === '' || trimmedPrevTitle === '') {
307-
return false;
308-
}
306+
// if (trimmedEventTitle === '' || trimmedPrevTitle === '') {
307+
// return false;
308+
// }
309309

310-
const distance = levenshtein(trimmedEventTitle, trimmedPrevTitle);
311-
const threshold = trimmedEventTitle.length * diffTreshold;
310+
// const distance = levenshtein(trimmedEventTitle, trimmedPrevTitle);
311+
// const threshold = trimmedEventTitle.length * diffTreshold;
312312

313-
return distance < threshold;
314-
}).pop();
313+
// return distance < threshold;
314+
// }).pop();
315315

316-
if (similarByLevenshtein) {
317-
return similarByLevenshtein;
318-
}
316+
// if (similarByLevenshtein) {
317+
// return similarByLevenshtein;
318+
// }
319319

320320
/**
321321
* If no match by Levenshtein, try matching by patterns

0 commit comments

Comments
 (0)