Skip to content

Index

FileIndex class.

Classes:

Name Description
FileIndex

Class to index files in the Logseq graph.

FileIndex(_files: set[LogseqFile] = set(), _name_to_files: dict[str, list[LogseqFile]] = (lambda: defaultdict(list))(), _path_to_file: dict[Path, LogseqFile] = dict()) dataclass

Class to index files in the Logseq graph.

Methods:

Name Description
__new__

Ensure only one instance of FileIndex is created.

__len__

Return the number of files in the index.

__iter__

Iterate over the files in the index.

__getitem__

Get a file by its key.

__contains__

Check if a file is in the index.

add

Add a file to the index.

remove

Strategy to remove a file from the index.

remove_deleted_files

Remove deleted files from the cache.

Attributes:

Name Type Description
graph_data dict[LogseqFile, dict[str, Any]]

Get metadata file data from the graph.

graph_content_data dict[LogseqFile, Any]

Get content data from the graph.

report dict[str, Any]

Generate a report of the indexed files.

graph_data: dict[LogseqFile, dict[str, Any]] property

Get metadata file data from the graph.

graph_content_data: dict[LogseqFile, Any] property

Get content data from the graph.

report: dict[str, Any] property

Generate a report of the indexed files.

__new__() -> Self

Ensure only one instance of FileIndex is created.

__len__() -> int

Return the number of files in the index.

__iter__() -> Iterator[LogseqFile]

Iterate over the files in the index.

__getitem__(f: Any) -> Any

Get a file by its key.

__contains__(f: Any) -> bool

Check if a file is in the index.

add(f: LogseqFile) -> None

Add a file to the index.

remove(f: Any) -> None

Strategy to remove a file from the index.

remove_deleted_files() -> None

Remove deleted files from the cache.