ahvn.klengine.scan_engine module¶
- class ahvn.klengine.scan_engine.ScanKLEngine(storage, name=None, condition=None, *args, **kwargs)[源代码]¶
基类:
BaseKLEngineA brute-force scan KLEngine implementation with zero storage overhead.
This engine performs search by scanning through the entire attached KLStore and using eval_filter on each KL to find matches. It is always inplace and supports all kinds of KLStores.
This is the simplest possible search engine - no indexing, no optimization, just linear scan. Useful for small datasets or as a fallback.
- Search Methods:
_search(topk, offset, include, **kwargs): Perform brute-force scan using eval_filter.
- Abstract Methods (inherited from BaseKLEngine):
_upsert(kl): No-op (always inplace). _remove(key): No-op (always inplace). _clear(): No-op (always inplace).
- 参数:
storage (BaseKLStore)
name (str | None)
condition (Callable | None)
- __init__(storage, name=None, condition=None, *args, **kwargs)[源代码]¶
Initialize the ScanKLEngine.
- 参数:
storage (
BaseKLStore) -- attach ScanKLEngine to a BaseKLStore (required).name (
Optional[str]) -- Name of the KLEngine instance. If None, defaults to "{storage.name}_scan_idx".condition (
Optional[Callable]) -- Optional upsert/insert condition to apply to the KLEngine. KLs that do not satisfy the condition will be ignored. If None, all KLs are accepted.*args -- Additional positional arguments passed to ScanKLEngine.
**kwargs -- Additional keyword arguments passed to ScanKLEngine.