Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/FilterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function FilterPanel({ data, onFilteredDataChange }) {
const [allTags, setAllTags] = useState([]);

// Deduplicate very similar items using fuzzy matching
const deduplicateSimilar = useCallback((items, threshold = 0.2) => {
const deduplicateSimilar = useCallback((items, threshold = 0.1) => {
if (items.length === 0) return items;

const deduplicated = [];
Expand Down Expand Up @@ -73,15 +73,15 @@ export default function FilterPanel({ data, onFilteredDataChange }) {
// Derive unique locations and tags when data loads
useEffect(() => {
const rawLocs = Array.from(new Set(data.map((e) => e.Location)));
const deduplicatedLocs = deduplicateSimilar(rawLocs, 0.15); // Very strict for locations
const deduplicatedLocs = deduplicateSimilar(rawLocs); // Very strict for locations
setLocations(deduplicatedLocs);

const tags = new Set();
data.forEach((e) => {
e.Tags?.split(",").forEach((t) => tags.add(t.trim()));
});
const rawTags = Array.from(tags).filter((t) => t);
const deduplicatedTags = deduplicateSimilar(rawTags, 0.2); // Slightly more lenient for tags
const deduplicatedTags = deduplicateSimilar(rawTags, 0.1); // Strict for tags
setAllTags(deduplicatedTags);
}, [data, deduplicateSimilar]);

Expand All @@ -101,7 +101,7 @@ export default function FilterPanel({ data, onFilteredDataChange }) {
if (appliedLocationFilter.length > 0) {
const selectedLocation = appliedLocationFilter[0];
const locationFuse = new Fuse([e.Location], {
threshold: 0.3, // Stricter threshold for locations
threshold: 0.1, // Stricter threshold for locations
minMatchCharLength: 1,
});
const locationMatch =
Expand All @@ -124,7 +124,7 @@ export default function FilterPanel({ data, onFilteredDataChange }) {

// Use fuzzy matching for tags - all selected tags must match
const tagFuse = new Fuse(eventTags, {
threshold: 0.3, // Stricter threshold for tags
threshold: 0.1, // Stricter threshold for tags
minMatchCharLength: 1,
});

Expand Down
Loading