| 443 | | 443 | |
| 444 | /** | 444 | /** |
| 445 | * Clears fuzzy search caches | 445 | * Clears fuzzy search caches |
| 446 | * @param {keyof typeof fuzzySearchCategories} [type] Optional cache type to clear. If not provided, clears all caches | | |
| 447 | */ | 446 | */ |
| 448 | clearFuzzySearchCaches(type = null) { | 447 | clearFuzzySearchCaches() { |
| 449 | if (type && this.fuzzySearchCaches[type]) { | | |
| 450 | this.fuzzySearchCaches[type].resultMap.clear(); | | |
| 451 | console.log(`Fuzzy search cache cleared for: ${type}`); | | |
| 452 | } else { | | |
| 453 | for (const cache of Object.values(this.fuzzySearchCaches)) { | 448 | for (const cache of Object.values(this.fuzzySearchCaches)) { |
| 454 | cache.resultMap.clear(); | 449 | cache.resultMap.clear(); |
| 455 | } | 450 | } |
| 456 | console.log('All fuzzy search caches cleared'); | 451 | console.log('All fuzzy search caches cleared'); |
| 457 | } | 452 | } |
| 458 | } | 453 | } |
| 459 | } | | |