mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-10 05:39:11 +00:00
Use LRU helper class for explicit filter cache
This commit is contained in:
@@ -3,13 +3,12 @@ import re
|
|||||||
import time
|
import time
|
||||||
import pickle
|
import pickle
|
||||||
import logging
|
import logging
|
||||||
from copy import deepcopy
|
|
||||||
|
|
||||||
# External Packages
|
# External Packages
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.utils.helpers import resolve_absolute_path
|
from src.utils.helpers import LRU, resolve_absolute_path
|
||||||
from src.utils.config import SearchType
|
from src.utils.config import SearchType
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ class ExplicitFilter:
|
|||||||
self.entry_key = entry_key
|
self.entry_key = entry_key
|
||||||
self.search_type = search_type
|
self.search_type = search_type
|
||||||
self.word_to_entry_index = dict()
|
self.word_to_entry_index = dict()
|
||||||
self.cache = {}
|
self.cache = LRU()
|
||||||
|
|
||||||
|
|
||||||
def load(self, entries, regenerate=False):
|
def load(self, entries, regenerate=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user