Skip to content

Commit

Permalink
Enable fuzzy filter, remove excess logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanem committed Nov 22, 2024
1 parent bb19d19 commit 7385183
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 1 addition & 2 deletions src/components/application/GenericTable/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ export const table_filter = (data, columnfilter: ColumnFilter, searchtext = '',
);

if (fuzzyFilter) {
return filtered;
//return fuzzyFilter(data, filtered, searchtext, customFilter);
return fuzzyFilter(data, filtered, searchtext, customFilter);
} else {
return filtered;
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/pages/useAppTableData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ export const fuzzySortFilter = (data, filtered, searchtext, customFilter) => {
if (filtered?.length < 10) {
// Only perform fuzzy filtering if there are < 10 exact match results
const fuzzyResults = fuzzysort.go(searchtext, data, { key: 'name', limit: 20 }) as any;
console.log({ fuzzyResults, searchtext });
var combined = [...filtered];
fuzzyResults?.forEach(fr => {
if (!combined.find(r => r._id === fr?.obj?._id)) {
// If no custom filter or custom filters (platform tags) match, then add fuzzy results
// This prevents non matching platform tags from showing in the results
if (!customFilter || customFilter(fr.obj, searchtext)) {
console.log('Adding fuzzy search result', fr);
combined = combined.concat(fr.obj);
}
}
Expand Down

0 comments on commit 7385183

Please sign in to comment.