mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-01-04 09:55:33 +10:00
Use a generator for snapshot flush from index
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List, Union
|
||||
from typing import List, Union, Generator
|
||||
from pathlib import Path
|
||||
from importlib import import_module
|
||||
|
||||
@@ -39,7 +39,7 @@ def write_search_index(link: Link, texts: Union[List[str], None]=None, out_dir:
|
||||
backend.index(snapshot_id=str(snap.id), texts=texts)
|
||||
|
||||
@enforce_types
|
||||
def query_search_index(text: str) -> List:
|
||||
def query_search_index(text: str) -> List[str]:
|
||||
if search_backend_enabled():
|
||||
backend = import_backend()
|
||||
return backend.search(text)
|
||||
@@ -47,9 +47,8 @@ def query_search_index(text: str) -> List:
|
||||
return []
|
||||
|
||||
@enforce_types
|
||||
def flush_search_index(snapshot_ids: List[str]):
|
||||
def flush_search_index(snapshot_ids: Generator[str, None, None]):
|
||||
if not indexing_enabled() or not snapshot_ids:
|
||||
return
|
||||
backend = import_backend()
|
||||
backend.flush(snapshot_ids)
|
||||
|
||||
Reference in New Issue
Block a user